SCCM Get Dell warranty info
by Ryan on Mar.10, 2010, under Coding/Scripting, SCCM SMS, Sys Admin, Windows, vbs
LAST UPDATED: 2010-03-30
Version 2: work around for computer account that can’t access the internet http://ninet.org/2010/03/sccm-get-dell-warranty-info-v2/
I found a script and mof edit here: Sherry Kissinger’s Blog at myitforums.com
However when I tried it, it was completely broken all the data being returned in the wrong place. So I have rewritten it so that it is more modular and hopefully easier to maintain.
Now a bit of a disclaimer, my vbs skills are very rusty so the script works though it probably isn’t very efficient. So if you can suggest improvements please do and I’ll update the script as needed.
Although the code is long most of it is comments and “wscript.echo” statements for debugging, feel free to strip them out if you want something more compact.
I have also added the ability to dump the results to a csv file that you can collect with SCCM if you don’t want to capture from WMI.
Gotchas:
- If you have used older versions of this script then you might need to change “v_gs_warranty_info0” to “v_gs_warranty_info1” or some other number.
- If you get the error: “Object Name ‘v_gs_Warranty_Info0′ invalid.” It is likely your computer accounts cannot access the internet in order to download the data and insert it into WMI. Two ways to id this problem:
1. On a client the script has been run on, open wbemtest -> Connect to “root\cimv2″ and open the Class “Warranty_Info”. If there is no class then the script has either bailed due to afore mentioned problem or hasn’t been run as admin and so hasn’t got permissions to update WMI.
2. Enable logging in the script, redeploy the script and look in the log file to see where it stops, this is the prefered method.
Change Log
Version 0.4 – 2010-03-17
- Removed useless code (SMS reporting and deleteWMI root\cimv2\SMS)
- Added Logging to file, disabled by default.
Files
Dell Warranty Info Monolithic Script (311)- Dell Warranty Info MOF edit (275)
- Dell Warranty Info Report (299)
Code:
Open “<SCCM>\inboxes\clifiles.src\hinv\sms_def.mof” and append the following:
// <:[-<>>>>>>>>>>>>>>>>>>>>>>Begin>>-Warranty Info-<<Begin<<<<<<<<<<<<<<<<<<<<<<>=]:>
#pragma namespace ("\\\\.\\root\\cimv2\\SMS")
[ SMS_Report (TRUE),
SMS_Group_Name ("Warranty Info"),
SMS_Class_ID ("CUSTOM|Warranty_Info|3.0") ]
class Warranty_Info : SMS_Class_Template
{
[SMS_Report(TRUE)] string DateScriptRan;
[SMS_Report(TRUE)] string ServiceTag;
[SMS_Report(TRUE)] string SystemType;
[SMS_Report(TRUE)] string ShipDate;
[SMS_Report(TRUE)] string DellIBU;
[SMS_Report(TRUE), Key] string Description;
[SMS_Report(TRUE)] string Provider;
[SMS_Report(TRUE)] string StartDate;
[SMS_Report(TRUE)] string EndDate;
[SMS_Report(TRUE)] uint32 DaysLeft;
[SMS_Report(TRUE)] string WarrantyExtended;
};
// <:[-<>>>>>>>>>>>>>>>>>>>>>>End>>-Warranty Info-<<END<<<<<<<<<<<<<<<<<<<<<<>=]:>
Report Code:
SELECT sys.netbios_name0, wi.datescriptran0 AS [Timestamp data gathered], wi.ServiceTag0 AS [Service Tag], wi.SystemType0 AS [System Type], wi.provider0 AS [Provider], wi.shipdate0 AS [Ship Date], wi.Description0 AS [Description], wi.Startdate0 AS [Warranty Start Date], wi.Enddate0 AS [Warranty End Date], wi.DaysLeft0 AS [Warranty Days Remaining], wi.WarrantyExtended0 AS [Warranty Extended], wi.dellIBU0 AS [Dell IBU] FROM v_r_system as [SYS] JOIN v_gs_Warranty_Info0 AS [WI] ON sys.resourceid=wi.resourceid ORDER BY sys.netbios_name0
VBS Code:
'################################################################################
'# warrantyInfo.vbs - Version 0.4 #
'# Copyright 2010 Ryan McLean (ryan1_00 _A_T_ hotmail _D_O_T_ com) #
'# #
'# License: GPL v2 or later #
'# #
'# Thanks to: #
'# Sherry Kissinger for posting the original script (I found it on myitforum) #
'# Chris Duszenski for the Updated version of the script that this is based on #
'# #
'# Notes: #
'# You MUST update your sms_def.mof file with the code below if you want #
'# to use the WMI for capturing. IT IS DIFFERENT from other versions of #
'# this script #
'# #
'# Disclaimer: #
'# This script "works for me", it may break your network, it may cause #
'# world war 3. If it does, or even if it doesn't work at all, I am not #
'# not liable, there is no warranty implied or otherwise. #
'# By using the script you agree that anything it does or doesn't do is your #
'# own fault and not mine. #
'# #
'# If in doubt read the code, all improvements, suggestions and fixs welcome #
'# #
'# #
'################################################################################
On Error Resume Next
'############# USER CHANGEABLE CONSTANTS ########
' URL for dell service information
Const DELLSUPPORTURL = "http://support.dell.com/support/topics/global.aspx/support/my_systems_info/details?c=us&l=en&s=gen&~tab=1&ServiceTag="
' Version Number here should match the SMS_DEF.mof file line:
' CUSTOM|Warranty_Info|X.X
Const SMSDEFVERSION = "3.0"
' Logging
Const LOG = false
Const LOGFILE = "C:\Windows\Logs\SCCM-Dell_Warranty_Info.log"
' Write output to file instead of to WMI
Const TOFILE = false
Const OUTFILE = "C:\warrantyInfo.csv"
' HTML File to use for testing
Const USETESTFILE = false
Const HTMLFILE = "C:\service.html"
'################################################
'############# CALL MAIN ########################
Main()
'################################################
'############# CONSTANTS ########################
' File I/O
Const forREADING = 1
Const forWRITING = 2
Const forAPPENDING = 8
' WMI
Const wbemCimtypeSint16 = 2
Const wbemCimtypeSint32 = 3
Const wbemCimtypeReal32 = 4
Const wbemCimtypeReal64 = 5
Const wbemCimtypeString = 8
Const wbemCimtypeBoolean = 11
Const wbemCimtypeObject = 13
Const wbemCimtypeSint8 = 16
Const wbemCimtypeUint8 = 17
Const wbemCimtypeUint16 = 18
Const wbemCimtypeUint32 = 19
Const wbemCimtypeSint64 = 20
Const wbemCimtypeUint64 = 21
Const wbemCimtypeDateTime = 101
Const wbemCimtypeReference = 102
Const wbemCimtypeChar16 = 103
'################################################
'############# MAIN() ###########################
Sub Main()
'wscript.echo "Main.."
Dim strServicetag, rawHTML
strServicetag = ""
ScriptRunDate = Now
'wscript.echo ScriptRunDate
If LOG = true Then
strErr = now & ",Main," & "," & "Script starting"
Call writeFile (strErr, true)
End If
'wscript.echo "Get Service Tag..."
strServicetag = getServiceTag()
'wscript.echo strServicetag
'wscript.echo "Get Dell Support Page..."
If USETESTFILE = false Then
If LOG = true Then
strErr = now & ",Main," & "," & "Getting Dell Page from Web"
Call writeFile (strErr, true)
End If
rawHTML = getDellSupportPage(strServicetag)
Else
If LOG = true Then
strErr = now & ",Main," & "," & "Getting Dell Page from File:" & HTMLFILE
Call writeFile (strErr, true)
End If
rawHTML = readFile(HTMLFILE)
End If
'wscript.echo "Process HTML"
arrData = processHTML(rawHTML)
If TOFILE = false Then
If LOG = true Then
strErr = now & ",Main," & "," & "Output to WMI"
Call writeFile (strErr, true)
End If
'wscript.echo "Delete WMI Warranty Info.."
call deleteWMIWarrantyInfo()
'wscript.echo "Create WMI Warranty Info Class.."
call CreateWMIWarrantyInfoClass()
'wscript.echo "Populate WMI Warranty Info.."
call populateWMIWarrantyInfo(arrData,ScriptRunDate)
Else
If LOG = true Then
strErr = now & ",Main," & "," & "Output to File"
Call writeFile (strErr, true)
End If
strData = prepareForFile(arrData,ScriptRunDate)
call writeFile(strData, false)
End If
'wscript.echo "Done"
If LOG = true Then
strErr = now & ",Main," & "," & "Script Finished"
Call writeFile (strErr, true)
End If
wscript.quit(0)
End Sub
'################################################
'############# FUNCTIONS AND SUB ROUTINES #######
Function getServiceTag()
'wscript.echo "Getting Service Tag..."
Dim objSWbemServices, colSWbemObjectSet, objSWbemObject, stag
Set objSWbemServices = GetObject("winmgmts:\\.\root\cimv2")
Set colSWbemObjectSet = objSWbemServices.ExecQuery("SELECT * FROM win32_bios")
For Each objSWbemObject In colSWbemObjectSet
stag = objSWbemObject.SerialNumber
Next
If LOG = true Then
strErr = now & ",getServiceTag," & "," & "Service Tag: " & stag
Call writeFile (strErr, true)
End If
getServiceTag = stag
End Function
Function getDellSupportPage(tag)
'wscript.echo "Getting Dell Support Page..."
Dim strURL, objHTTP
strURL = DELLSUPPORTURL & tag
Set objHTTP = CreateObject("Msxml2.XMLHTTP")
objHTTP.open "GET", strURL, False
objHTTP.send
If objHTTP.status = 200 Then
getDellSupportPage = objHTTP.responseText
else
strErr = now & ",getDellSupportPage," & objHTTP.status & "," & "Description: " & objHttp.GetErrorDescription(objHttp.LastError)
'wscript.echo strErr
If LOG = true Then
Call writeFile (strErr, true)
End If
wscript.quit(1)
End If
End Function
Function processHTML(html)
'wscript.echo "Processing HTML..."
' Declare
Dim intSummaryPos, intSummaryTable1Start, intSummaryTable1End, intSummaryTable2Start
Dim intSummaryTable2End
Dim table1, table2
'Initialise
intSummaryPos = 0
intSummaryTable1Start = 0
intSummaryTable1End = 0
intSummaryTable2Start = 0
intSummaryTable2End = 0
table1 = ""
table2 = ""
'Process
intSummaryPos = InStr(LCase(html), "service tag:")
'wscript.echo "Summary Start: " & intSummaryPos
If intSummaryPos > 0 Then
intSummaryTable1Start = InStrRev(LCase(html), "<table", intSummaryPos)
intSummaryTable1End = InStr(intSummaryPos, LCase(html), "</table>") + 8
intSummaryTable2Start = InStr(intSummaryTable1End, LCase(html), "<table")
intSummaryTable2End = InStr(intSummaryTable2Start, LCase(html), "</table>")
'wscript.echo "T1S: " & intSummaryTable1Start & vbcrlf & "T1E: " & _
' intSummaryTable1End & vbcrlf & "T2S: " & intSummaryTable2Start & _
' vbcrlf & "T2E: " & intSummaryTable2End
End If
table1 = getSStr(intSummaryTable1Start, intSummaryTable1End, html)
'wscript.echo "table1: " & vbcrlf & table1
table2 = getSStr(intSummaryTable2Start, intSummaryTable2End, html)
'wscript.echo "table2: " & vbcrlf & table2
' "Service Tag, System Type, Ship Date, Dell IBU"
arrGeneral = processTables(table1,1)
' "Description, Provider, Start Date, End Date, Days Left"
arrContracts = processTables(table2,2)
'Clean up the contracts
arrContracts = CleanContracts(arrContracts)
' Make single array
strDetails = ""
For Each x in arrGeneral
strDetails = strDetails & "|" & trim(x)
Next
For Each x in arrContracts
strDetails = strDetails & "|" & trim(x)
Next
strDetails = Right(strDetails, len(strDetails) - 1)
arrDetails = Split(strDetails, "|")
If LOG = true Then
strErr = now & ",processHTML," & "," & "Details Returned: " & strDetails
Call writeFile (strErr, true)
End If
'wscript.echo strDetails
processHTML = arrDetails
End Function
Function getSStr(startpos, endpos, data)
'wscript.echo "Getting Sub-String.."
Dim tmp
'wscript.echo "Start: " & startpos & vbcrlf & "End: " & endpos & vbcrlf & "Diff: " & endpos - startpos
'Get the substring
tmp = Mid(data, startpos, endpos - startpos)
' Remove end of line
tmp = Replace(Replace(Replace(tmp, VbCrLf, ""), vbCr, ""), vbLf, "")
getSStr = tmp
End Function
Function processTables(table, ttype)
'wscript.echo "Processing Table..."
' Remove HTML Tags and replace with "|"
Set re = New RegExp
re.Pattern = "<[^>]+>"
re.IgnoreCase = True
re.Global = True
table = re.Replace(table, "|")
table = Replace(table, "Change Service Tag", "")
table = Replace(table, " ", "")
table = Replace(table, ":", "")
' Remove excess |
re.Pattern = "[|]+"
table = re.Replace(table, "|")
' Clean up a bit more
re.Pattern = "\|\s+\|"
table = re.Replace(table, "|")
' Remove | from start and end of string
re.Pattern = "^\||\|$"
table = re.Replace(table, "")
'wscript.echo table
arrTable = Split(table, "|")
arrTmp = ""
If ttype = 1 Then ' General Info Table
i = 1
For Each cell in arrTable
If i MOD 2 = 0 Then
'wscript.echo cell
arrTmp = arrTmp & "|" & cell
End If
i = i + 1
next
ElseIf ttype = 2 Then ' Contract Info
i = 0
For Each cell in arrTable
If i > 4 Then
'wscript.echo cell
arrTmp = arrTmp & "|" & cell
End If
i = i + 1
next
End If
' Remove | from start and end of string
re.Pattern = "^\||\|$"
arrTmp = re.Replace(arrTmp, "")
'wscript.echo arrTmp
arrResult = Split(arrTmp, "|")
Set re = Nothing
processTables = arrResult
End Function
Function CleanContracts(array)
'wscript.echo "Cleaning Contracts.."
' If there is a list of contracts like so:
'
' "Description", "Provider", "Ship Date", "Start Date", "Days Left"
' Dell Business Support / ProSupport, DELL, 2/20/2008, 2/20/2012, 712
' Next Business Day, DELL, 2/20/2008, 2/20/2012, 712
' Next Business Day, DELL, 2/20/2008, 2/20/2011, 347
'
' We Don't care about the NBD, 347 Day contract as we have extended
' So we only want to report on the 712 day contract as that is what is
' in effect.
' However as the 347 Day contract is last it will be the last one entered
' and so overwrite the 712 day contract.
' This function compares the contracts and if the Descriptions are the same
' compares the days left and keeps only the longest.
intLoopCount = (UBound(array)+1) / 5
shortlist = ""
For i = 1 To intLoopCount
intMultiplier = 5*(i-1)
'wscript.echo array(0+intMultiplier) ' Description
'wscript.echo array(4+intMultiplier) ' Days Left
For x = 1 To intLoopCount
multiplier2 = 5*(x-1)
'wscript.echo "1: " & intMultiplier & vbcrlf & "2: " & multiplier2
If intMultiplier <> multiplier2 Then
If array(0+intMultiplier) = array(0+multiplier2) Then
If array(4+intMultiplier) > array(4+multiplier2) Then
shortlist = shortlist & "|" & multiplier2
End If
End If
End If
Next
Next
arrShortlist = split(Right(shortlist, len(shortlist)-1), "|")
strNewArr = ""
slmatch = false
For i = 0 To UBound(array)
'wscript.echo array(i)
strNewArr = strNewArr & "|" & array(i)
For Each intShortlist in arrShortlist
If i = (cint(intShortlist)-1) Then
i = i + 5
slmatch = true
End If
Next
Next
if slmatch = true then
extension = "true"
else
extension = "false"
end if
strNewArr = extension & strNewArr
'wscript.echo strNewArr
CleanContracts = split(strNewArr, "|")
End Function
Sub deleteWMIWarrantyInfo()
on error resume next
'wscript.echo "Deleting WMI Warranty Info.."
Set oLocation = CreateObject("WbemScripting.SWbemLocator")
'Remove classes
Set oServices = oLocation.ConnectServer(, "root\cimv2")
Set oNewObject = oServices.Get("Warranty_Info")
If Err.Number = -2147217406 Then
strErr = now & ",deleteWMIWarrantyInfo,,WMI Class 'Warranty_Info' does not exist"
If LOG = true Then
Call writeFile (strErr, true)
End If
ElseIF Err.Number <> 0 Then
strErr = now & ",deleteWMIWarrantyInfo," & Err.Number & "," & Err.Description
If LOG = true Then
Call writeFile (strErr, true)
End If
Else
oNewObject.Delete_
If LOG = true Then
strErr = now & ",deleteWMIWarrantyInfo," & "," & "Warranty_Info class deleted"
Call writeFile (strErr, true)
End If
End If
Set oLocation = Nothing
Set oServices = Nothing
End Sub
Sub CreateWMIWarrantyInfoClass()
'wscript.echo "Creating WMI Warranty Info Class.."
Set oLocation = CreateObject("WbemScripting.SWbemLocator")
Set oServices = oLocation.ConnectServer(, "root\cimv2")
'Create data class structure
Set oDataObject = oServices.Get
oDataObject.Path_.Class = "Warranty_Info"
oDataObject.Properties_.add "DateScriptRan", wbemCimtypeString
oDataObject.Properties_.add "ServiceTag", wbemCimtypeString
oDataObject.Properties_.add "SystemType", wbemCimtypeString
oDataObject.Properties_.add "ShipDate", wbemCimtypeString
oDataObject.Properties_.add "DellIBU", wbemCimtypeString
oDataObject.Properties_.add "Description", wbemCimtypeString
oDataObject.Properties_.add "Provider", wbemCimtypeString
oDataObject.Properties_.add "StartDate", wbemCimtypeString
oDataObject.Properties_.add "EndDate", wbemCimtypeString
oDataObject.Properties_.add "DaysLeft", wbemCimtypeUint32
oDataObject.Properties_.add "WarrantyExtended", wbemCimtypeString
oDataObject.Properties_("Description").Qualifiers_.add "key", True
oDataObject.Put_
Set oLocation = Nothing
Set oServices = Nothing
Set oDataObject = Nothing
End Sub
Sub populateWMIWarrantyInfo(data, sRunDate)
'wscript.echo "Populating WMI Warranty Info.."
Set oLocation = CreateObject("WbemScripting.SWbemLocator")
Set oServices = oLocation.ConnectServer(, "root\cimv2")
'Calc contracts
intContractCount = UBound(data) - 4
'wscript.echo "Total elements: " & UBound(data) & vbcrlf & _
' "Contract Elements: " & intContractCount
intLoopCount = intContractCount / 5
'wscript.echo "Number of Loops: " & intLoopCount
'Populate
For i = 1 To intLoopCount
'wscript.echo "DateScriptRan: " & sRunDate
'wscript.echo "ServiceTag: " & data(0)
'wscript.echo "SystemType: " & data(1)
'wscript.echo "ShipDate: " & data(2)
'wscript.echo "DellIBU: " & data(3)
'wscript.echo "Description: " & data(5+(5*(i-1)))
'wscript.echo "Provider: " & data(6+(5*(i-1)))
'wscript.echo "StartDate: " & data(7+(5*(i-1)))
'wscript.echo "EndDate: " & data(8+(5*(i-1)))
'wscript.echo "DaysLeft: " & data(9+(5*(i-1)))
'wscript.echo "WarrantyExtended: " & data(4)
Set oNewObject = oServices.Get("Warranty_Info").SpawnInstance_
oNewObject.DateScriptRan = sRunDate
oNewObject.ServiceTag = data(0)
oNewObject.SystemType = data(1)
oNewObject.ShipDate = data(2)
oNewObject.DellIBU = data(3)
oNewObject.Description = data(5+(5*(i-1)))
oNewObject.Provider = data(6+(5*(i-1)))
oNewObject.StartDate = data(7+(5*(i-1)))
oNewObject.EndDate = data(8+(5*(i-1)))
oNewObject.DaysLeft = data(9+(5*(i-1)))
oNewObject.WarrantyExtended = data(4)
oNewObject.Put_
Next
Set oLocation = Nothing
Set oServices = Nothing
Set oNewObject = Nothing
End Sub
Function prepareForFile(data, sRunDate)
'Preparing outstring
'Calc contracts
intContractCount = UBound(data) - 4
'wscript.echo "Total elements: " & UBound(data) & vbcrlf & _
' "Contract Elements: " & intContractCount
intLoopCount = intContractCount / 5
'wscript.echo "Number of Loops: " & intLoopCount
outString = "'DateScriptRan','ServiceTag','SystemType','ShipDate','DellIBU','WarrantyExtended',"
outstring = outString & "'Description','Provider','StartDate','EndDate','DaysLeft'"
'Populate
'Create
For i = 1 To intLoopCount
outString = outString & vbcrlf
outString = outString & "'" & sRunDate & "',"
outString = outString & "'" & data(0) & "',"
outString = outString & "'" & data(1) & "',"
outString = outString & "'" & data(2) & "',"
outString = outString & "'" & data(3) & "',"
outString = outString & "'" & data(4) & "',"
outString = outString & "'" & data(5+(5*(i-1))) & "',"
outString = outString & "'" & data(6+(5*(i-1))) & "',"
outString = outString & "'" & data(7+(5*(i-1))) & "',"
outString = outString & "'" & data(8+(5*(i-1))) & "',"
outString = outString & "'" & data(9+(5*(i-1))) & "',"
Next
outString = Left(outString, len(outString)-1)
'wscript.echo outString
prepareForFile = outString
End Function
Sub writeFile(data, islog)
'wscript.echo "Writing file"
Set myFSO = CreateObject("Scripting.FileSystemObject")
If islog = true Then
'wscript.echo "Writing to: " & LOGFILE
Set myfile = myFSO.OpenTextFile(LOGFILE, forAPPENDING, True)
Else
'wscript.echo "Writing to: " & OUTFILE
Set myfile = myFSO.OpenTextFile(OUTFILE, forWRITING, True)
End If
myfile.WriteLine(data)
myfile.Close
Set myfile = Nothing
Set myFSO = Nothing
End Sub
'################################################
'############# TEST FUNCTIONS AND SUB ROUTINES ##
Function readFile(infile)
' Used to read in an HTML page that has been
' copied from the vendor site in order to reduce
' the hits on their site while testing
'wscript.echo "Reading file: " & infile
Dim objFSO, objFile, objReadFile
Dim strContents
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(infile)
If objFile.Size > 0 Then
Set objReadFile = objFSO.OpenTextFile(infile, forREADING)
strContents = objReadFile.ReadAll
objReadFile.Close
Else
Wscript.Echo "The file is empty."
End If
'wscript.echo strContents
readFile = strContents
End Function
'################################################
September 6th, 2010 on 12:03
Hey Ryan,
Been following your blog for a while with a great interest.
I just wanted to implement your script to our SCCM server as we are a Dell house, thinking it will be extremely useful for us to be able to view warranty status of our servers.
Previously, we had the very original script up and running from S Kisseinger’s site and recently noticed that it was not working anymore. So a quick google pointed me to your web site.
I have everything setup as instructed and it is not seem to be working for me.
To start with I am running the script manually to create the log files and understand how it all works. I can get the c:\windows\logs\SCCM-Dell_Warranty_Info file created and it has an info:
9/6/2010 11:10:00 AM,Main,,Script starting
9/6/2010 11:10:00 AM,getServiceTag,,Service Tag: J****
9/6/2010 11:10:00 AM,Main,,Getting Dell Page from Web
(Is this all you’re supposed to see?)
My main question is, I cannot get the c:\warrantyInfo.csv created?! Although script seems to run fine as I get no errors, I have no idea what is going on. (I have changed Const TOFILE = to TRUE within script).
Is there anything else you can recommend that I can do?
Many thanks and keep up the good work.
April 27th, 2010 on 08:40
@Phil,
The error is caused by “shortlist” being empty.
stick “wscript.echo shortlist” above that line and you’ll see.
April 26th, 2010 on 14:52
Thanks for this great info. The script completes successfully and does not create the Class. I commented out “On Error Resume Next” and there are a few issues it finds that I was able to correct. But I cannot get around this one:
“Microsoft VBScript runtime error (357, 2) : Invalid procedure call or argument: ‘Right’”
Any idea how to correct this line in the code:
arrShortlist = split(Right(shortlist, len(shortlist)-1), “|”)
Thanks
Phil
April 23rd, 2010 on 12:31
I that’s an HTTP error. That indicates that the computer account likely has not got permission to access the internet.
If you use wbemtest to open the class are there any instances in existance?
If not try running the script locally as an administrative user. If instances appear in the class after that then it is defo the comptuer account causing the problems.
I am working on 2 scripts to try and work around the issue.
1. http://ninet.org/2010/03/sccm-get-dell-warranty-info-v2/ uses 2 scripts run in sequence to access the data as the current user then populate it as admin.
2. This script isn’t on the blog yet but basically it connects to sccm, gets a list of computers and their tags dumping the warranty info for all computers into a csv file. The sccm admin then copies that file into a package with a 2nd script. The 2nd script will run on the computer, look at the csv file for all references to that computer and then will populate the WMI with the info so SCCM can collect it.
April 22nd, 2010 on 09:30
Hello, so in the Class “Warranty_Info” there Is a class “Warranty_Info” so it seems to be correct by cons in the log I get an error: “Failed in WinHttpSendRequest API, ErrorCode = 02xefd thank you.
April 21st, 2010 on 20:43
@Cyrielle,
Have you done the troubleshooting I asked you to?
April 21st, 2010 on 19:32
The script looks pretty efficient to me, and works great!
Admin Edit:
Shortened Name and removed Link as I am unsure if this is a Spammer or not. Sorry if not.
April 21st, 2010 on 15:07
After a relocation package and publication, I have another error:
An error occurred while running the report. The details are as follows:
Invalid column name ‘DaysLeft0′.
Error number: -2147217900
Source: Microsoft OLE DB Provider for SQL Server
Original error: 207
April 20th, 2010 on 13:34
Cyrielle,
I’ll add the meat of the response to the GOTCHAs section as it will be useful to others.
But in short “v_gs_Warranty_Info0″ doesn’t exist, so potential causes are:
1. SCCM hasn’t polled the machine to get the data from WMI yet.
2. The script hasn’t been run as admin, and cannot update WMI.
3. The computer account hasn’t got internet access so cannot to the dell site to get the info and the script has bailed.
April 20th, 2010 on 11:30
Hello, I followed your procedure but when I run my report it myself out this error:
An error occurred while running the report. The details are as follows:
Object Name ‘v_gs_Warranty_Info0′ invalid.
Error number: -2147217865
Source: Microsoft OLE DB Provider for SQL Server
Original error: 208
What is the problem? Thank you.
March 31st, 2010 on 14:51
I found the Reports I have:
http://ninet.org/2010/03/sccm-warranty-reporting/
March 30th, 2010 on 18:01
I’ll poke around and see if i can find that article you are talking about as well. We are an HP shop and this would be a great tool. Thanks for the quick reply.
March 30th, 2010 on 16:55
@Per: Downloadable files added.
@Whitefearn: If they have a webpage to view that info then yes it should be possible. It’s just a matter of parsing it. I have split the script so that it is broken down into procedures and Functions so it should be easy for you to just modify 1 or 2 sections.
If it were me I would copy the MOF edit and change it to reflect what fields are provided by HP. Then have the scripts modify the WMI to relect those changes. This way if you have Dell or other systems then the WMI info is seperate and can be queried seperately or merged in an SQL statement.
As a side note there is a script running about that lists all the systems with a link to the warranty page, I found it on the myitforms I think. I’ll try and get a post up with it on it later.
I only have a few HP servers, but if you do most of the leg work, I’d be happy to help customise the script so that it is “smart” and will get the warranty info depending on manufacturer.
March 30th, 2010 on 14:57
Do you know if there is a way to do this for HP servers as well?
March 30th, 2010 on 10:01
Please provide the files for download.