Find Dell Service Tag and Warranty info

When you want to find out the Dell service tag and warranty information of a server usually people log into a server  that has the Dell OpenManage installed, get the Service Tag information and then open a browser and type support.dell.com. After the person is on the page, he/she submits the Service Tag and the look for the warranty information up.

Now the whole process may have taken about 5 minutes for one server, but lets say your manager asks you to get that info 10, 20, 50 or 100 servers on a Friday afternoon and he needs the information the same day. For sure it is not going to be fun if you do it manually but there is an automated way you can do this.

Dell offers an API to query the warranty information. I have a written some code to query the API and get the warranty information.  There are two things you need. A list of server names and  make sure PowerShell remoting is enable.

When you query the API via a web browser, Dell gives you an XML document with the information

dell

This is the code to get the information

# you can replace this with list of servers
#$computers = 1..5 this was for testing purposes
$computers = Get-Content C:\Scripts\test.txt
#Define variable
$DellSystemInfo = $Null
foreach ($node in $computers){
# Get Dell Server serviceTag
$ServiceTag1 =(Get-CimInstance -ComputerName $node -ClassName Win32_ComputerSystemProduct).identifyingNumber
#Defines Dell URL. Notice $servicetag1 variable
$Url = "https://api.dell.com/support/v2/assetinfo/warranty/tags.xml?svctags=$servicetag1&apikey=d676cf6e1e0ceb8fd14e8cb69acd812d"
#Connects to Dell API and get correct information based on ProSupport
[xml]$WarrantyEndDate1 = invoke-webrequest $url -UseBasicParsing
$WarrantyEndDate2 = ($WarrantyEndDate1.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty | Where-Object {$_.ServiceLevelCode -eq 'TS'}).EndDate
#Cretes an order dictionary table as a place holder
$ComputerInfo = [Ordered]@{
Computername = $env:COMPUTERNAME
ServiceTag = $ServiceTag1
WarrantyEndDate = $WarrantyEndDate2
}
#Add info to pscustomobject
$DellSystemInfo += @(New-Object pscustomobject -Property $ComputerInfo)
}
Write-Output $DellSystemInfo

view raw
gistfile1.txt
hosted with ❤ by GitHub

 

As you can see I used Get-CimInstance because it utilizes port 5985/5986 to get the service tag information and to query Dell’s API I used Invoke-Webrequest. You can output the results to a text file, csv, html, etc.

This what the output on screen would look like. For this testing purpose I used the same computer  times

dell1

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s