One really cool usage of this was using ConfigMgr to run the script on PC's and add the information into WMI for inventorying later via mof edits.
Sherry Kissinger has an excellent article here:
http://myitforum.com/cs2/blogs/skissinger/archive/2008/12/03/dell-warranty-info-hardware-inventory-extension.aspx
While this is great for active clients, once the device is decommissioned or you have problems with the client and remove it from SCCM for one reason or another, your data is gone! Not so good for long term reporting or asset management.
Since I'm in the process of migrating all of our asset management reporting and information storage into Service Manager 2010, warranty expiration, start date, type etc was one of the main items of information that we needed to store so I started to think how I could automate this as much as possible.
3 Options sprang to mind:
- Supply Dell with a list of all our service tags and then CSV import it - allows large bulk updates but takes time if large volumes of updates required again.
- Implement the SCCM scripts then create a custom connector to gather the data - overly complex for my liking and duplicates the information storage
- Use Opalis to gather the data and update Service Manager - Sounded cool ;)
Things to note:
- This is proof of concept, failure handling etc would need adding for production
- I've extended the Windows Computer class in advance with a "Warranty Expiration Date" property. You could in theory extend any class to hold it, Computer (Deployed) might be more fitting but I've got other reasons for choosing the Windows Computer class.
So.... I created a policy that looks something like this:
First step is to get the GUID's of the Windows Computer objects, and then query them for their relationships with Computer (Deployed) objects.
Second Step is to then get the related Computer (Deployed) object which then gives us access to the Serial Number (Dell service tag) via the Opalis Databus and then pass it across to a Powershell Script.
All credit for this goes to Marcus Oh and his blog post here:
http://marcusoh.blogspot.com/2009/06/retrieving-dell-warranty-data-via.html
I've only tweaked his PS code slightly by adding proxy details so that I could get out of our network, added an underscore ( _ ) to the $sData = $sData | Select-String "contract_" line to stop an error about javascript that was happening and flattened the output by adding $Warranty =$cMyData | foreach {$_.EndDate} to only output the warranty end date. Same principal could be applied for start date, days left etc or output it all and do the manipulation in Opalis.
$sSerial = "{Serial Number from "Get Object - Computer (Deployed)"}"
$oWeb = New-Object System.Net.WebClient
$proxy = New-Object System.Net.WebProxy("YourProxyServerHere:8080")
$proxy.UseDefaultCredentials = $true
$oWeb.proxy = $proxy
$sUrl = "http://support.euro.dell.com/support/topics/topic.aspx/emea/shared/support/my_systems_info/en/details?c=uk&cs=RC1050265&l=en&s=pad&~ck=anavml&servicetag=$($sSerial)"
$sData = $oWeb.DownloadString($sUrl)
$sData = $sData -creplace '<a style.*?>', ''
$sData = $sData | ForEach-Object { $_ -replace "<i>", "" }
$sData = $sData | ForEach-Object { $_.Split("<") }
$sData = $sData | Select-String "contract_"
$sData = $sData | ForEach-Object { $_ -replace $_,"$_`n" }
$oRegEx = [regex]'"contract_.*row">(.*)'
$cMatches = $oRegEx.Matches($sData)
$cMatches = $cMatches | ForEach-Object { $_.Groups[1].value }
$cMyData = @()
foreach ($i in 0..($cMatches.count -1)) {
$cRecord = New-Object -TypeName system.Object
[void] $foreach.MoveNext()
$cRecord | Add-Member -MemberType noteProperty -Name 'Provider' $cMatches[$foreach.current]
[void] $foreach.MoveNext()
$cRecord | Add-Member -MemberType noteProperty -Name 'StartDate' $cMatches[$foreach.current]
[void] $foreach.MoveNext()
$cRecord | Add-Member -MemberType noteProperty -Name 'EndDate' $cMatches[$foreach.current]
[void] $foreach.MoveNext()
if ($cMatches[$foreach.current] -ne "") {
$cRecord | Add-Member -MemberType noteProperty -Name 'DaysLeft' $cMatches[$foreach.current]
} else {
$cRecord |
Add-Member -MemberType noteProperty -Name 'DaysLeft' "0"
}
$cMyData += $cRecord
}
$Warranty = $cMyData | foreach {$_.EndDate}
$oWeb = New-Object System.Net.WebClient
$proxy = New-Object System.Net.WebProxy("YourProxyServerHere:8080")
$proxy.UseDefaultCredentials = $true
$oWeb.proxy = $proxy
$sUrl = "http://support.euro.dell.com/support/topics/topic.aspx/emea/shared/support/my_systems_info/en/details?c=uk&cs=RC1050265&l=en&s=pad&~ck=anavml&servicetag=$($sSerial)"
$sData = $oWeb.DownloadString($sUrl)
$sData = $sData -creplace '<a style.*?>', ''
$sData = $sData | ForEach-Object { $_ -replace "<i>", "" }
$sData = $sData | ForEach-Object { $_.Split("<") }
$sData = $sData | Select-String "contract_"
$sData = $sData | ForEach-Object { $_ -replace $_,"$_`n" }
$oRegEx = [regex]'"contract_.*row">(.*)'
$cMatches = $oRegEx.Matches($sData)
$cMatches = $cMatches | ForEach-Object { $_.Groups[1].value }
$cMyData = @()
foreach ($i in 0..($cMatches.count -1)) {
$cRecord = New-Object -TypeName system.Object
[void] $foreach.MoveNext()
$cRecord | Add-Member -MemberType noteProperty -Name 'Provider' $cMatches[$foreach.current]
[void] $foreach.MoveNext()
$cRecord | Add-Member -MemberType noteProperty -Name 'StartDate' $cMatches[$foreach.current]
[void] $foreach.MoveNext()
$cRecord | Add-Member -MemberType noteProperty -Name 'EndDate' $cMatches[$foreach.current]
[void] $foreach.MoveNext()
if ($cMatches[$foreach.current] -ne "") {
$cRecord | Add-Member -MemberType noteProperty -Name 'DaysLeft' $cMatches[$foreach.current]
} else {
$cRecord |
Add-Member -MemberType noteProperty -Name 'DaysLeft' "0"
}
$cMyData += $cRecord
}
$Warranty = $cMyData | foreach {$_.EndDate}
Final steps, we'll split the incoming data to make it easier to handle, we'll assume for this PoC that the FIRST field returned is the correct warranty expiration date (it seemed to be in all the ones I manually checked).
Then we'll format that returned data into a date format that can be used by Service Manager.
Then finally we'll update the extended property created earlier with the information.
Et Voila! This could either be setup now to run when objects are updated by using the "Monitor Object" SCSM IP component and scoping it for updated serial number properties, or schedule it to run at scheduled times or even just manually when you desire.
Remember, this is proof of concept, it works in my test lab, but will need developing and testing before you would use it in a production environment.
No comments:
Post a Comment