' DellWarrantyInfo.vbs ' Description: Screen-scrape Dell warranty information based on a list of Service Tag numbers. ' Based on SMS Inventory script here: http://myitforum.com/cs2/blogs/skissinger/archive/2010/01/13/dell-warranty-information-script-small-update.aspx ' Input: Computers.txt, ASCII file with one Service Tag per line ' Output DellInventory.xlsx - Excel 2007 spreadsheet containing warranty information. ' DISCLAIMER: Use this script at your own risk. Dim objXL, objFSO,objShell, strCurrentDir, objTextFile arrHeadings = Array("Service Tag:", "Days Left") Set objHTTP = CreateObject("Msxml2.XMLHTTP") Dim strField(400) strfield(0) = Now Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set strCurrentDir = objFSO.GetFolder(".") ' Check if Computers.txt exists If Not objFSO.FileExists(strCurrentDir & "\Computers.txt") Then MsgBox "Cannot find Computers.txt. Exiting." WScript.Quit Else Set objTextFile = objFSO.OpenTextFile(strCurrentDir & "\Computers.txt") End If ' /////////////////// ' /// Main Module /// ' /////////////////// ' Create Excel spreadsheet for output Set objXL = WScript.CreateObject("Excel.Application") objXL.Visible = False objXL.DisplayAlerts = False ' Create Spreadsheet Set objWb = objXL.WorkBooks.Add ' Add Heading information objXL.ActiveSheet.Cells(1,1).Value="Service Tag" objXL.ActiveSheet.Cells(1,2).Value="System Type" objXL.ActiveSheet.Cells(1,3).Value="Ship Date" objXL.ActiveSheet.Cells(1,4).Value="Dell IBU" objXL.ActiveSheet.Cells(1,5).Value="Description" objXL.ActiveSheet.Cells(1,6).Value="Provider" objXL.ActiveSheet.Cells(1,7).Value="Warranty Extension Notification" objXL.ActiveSheet.Cells(1,8).Value="Start Date" objXL.ActiveSheet.Cells(1,9).Value="End Date" objXL.ActiveSheet.Cells(1,10).Value="Days Left" ' Put cursor at A2 objXL.ActiveSheet.range("A2").Activate intCount = 0 'Set objTextFile = objFSO.OpenTextFile(strCurrentDir & "\Computers.txt") Do Until objTextFile.AtEndOfStream strServiceTag = objTextFile.ReadLine Call GetWarrantyInfo intCount = intCount + 1 'Running total of computers Loop objTextFile.Close ' Autofit spreadsheet data Set xlRange = objXL.ActiveSheet.Range("A1:I" & intCount).CurrentRegion xlRange.EntireColumn.AutoFit() ' Put cursor at A2 objXL.ActiveSheet.range("A2").Activate ' Save Spreadsheet objXL.ActiveWorkbook.SaveAs strCurrentDir & "\DellInventoryReport.xlsx" objXL.Application.Quit WScript.Echo "Script complete." ' /////////////////////// ' /// GetWarrantyInfo /// ' /////////////////////// Sub GetWarrantyInfo 'Get SerialNumber (Service Tag) strURL = "http://support.dell.com/support/topics/global.aspx/support/my_systems_info/details?c=us&l=en&s=gen&ServiceTag=" & strServiceTag & "&~tab=1" objHTTP.open "GET", strURL, False objHTTP.send strPageText = objHTTP.responseText For Each strHeading In arrHeadings intSummaryPos = InStr(LCase(strPageText), LCase(strHeading)) If intSummaryPos > 0 Then intSummaryTableStart = InStrRev(LCase(strPageText), "