MSEndpointMgr

Get Dell System Warranty with PowerShell

When you work with Dell systems and its time to replace old systems, it’s always nice to know which one is out of warranty and eligible for replacement. Earlier I’ve used a VB-script for this purpose, but I strongly believe it’s time to migrate your scripts into PowerShell. When you search the web for PowerShell scripts that can show you the warranty status, you’ll find that there are quite a few out there. Some are working, some not. Recently Dell made some changes to their web services causing the old scripts to break. Luckily I found a script that was using the latest web service from Dell. That script can be found here.
I wanted to have the option of getting the warranty information in 3 different ways. First of by just enter a service tag. The second option was to enter a computer name. And the third option was to import service tags from a file, query for the warranty status and then export each service tag’s information to a CSV file. The script below is a heavily modified version of the one found on poshcode.org, kudos to the original writer for providing with the function.

The Script

Save the script below to DellWarrantyInformation.ps1. I’ll store it in E:\DellWarranty for the purpose of this post.

[CmdletBinding()]
param(
    

[parameter(Mandatory=$false)]

[string]$ServiceTag,

[parameter(Mandatory=$false)]

[string]$ComputerName,

[parameter(Mandatory=$false)]

[switch]$ExportCSV,

[parameter(Mandatory=$false)]

[string]$ImportFile ) function Get-DellWarrantyInfo { [CmdletBinding()] param( [Parameter(Mandatory=$False,Position=0,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]

[alias(“SerialNumber”)]

[string[]]$GetServiceTag ) Process { if ($ServiceTag) { if ($ServiceTag.Length -ne 7) { Write-Warning “The specified service tag wasn’t entered correctly” break } } $WebProxy = New-WebServiceProxy -Uri “https://xserv.dell.com/services/AssetService.asmx?WSDL” -UseDefaultCredential $WebProxy.Url = “https://xserv.dell.com/services/AssetService.asmx” $WarrantyInformation = $WebProxy.GetAssetInformation(([guid]::NewGuid()).Guid, “Dell Warranty”, $GetServiceTag) $WarrantyInformation | Select-Object -ExpandProperty Entitlements return $WarrantyInformation } } if ($ServiceTag) { if (($ComputerName) -OR ($ExportCSV) -OR ($ImportFile)) { Write-Warning “You can’t combine the ServiceTag parameter with other parameters” } else { $WarrantyObject = Get-DellWarrantyInfo -GetServiceTag $ServiceTag | Select-Object @{Label=”ServiceTag”;Expression={$ServiceTag}},@{label=”StartDate”;Expression={$_.StartDate.ToString().SubString(0,10)}},@{label=”EndDate”;Expression={$_.EndDate.ToString().SubString(0,10)}},DaysLeft,EntitlementType $WarrantyObject[0,1] #Remove [0,1] to get everything } } if ($ComputerName) { if (($ServiceTag) -OR ($ExportCSV) -OR ($ImportFile)) { Write-Warning “You can’t combine the ComputerName parameter with other parameters” } else { [string]$SerialNumber = (Get-WmiObject -Namespace “root\cimv2″ -Class Win32_SystemEnclosure -ComputerName $ComputerName).SerialNumber $WarrantyObject = Get-DellWarrantyInfo -GetServiceTag $SerialNumber | Select-Object @{Label=”ComputerName”;Expression={$ComputerName}},@{label=”StartDate”;Expression={$_.StartDate.ToString().SubString(0,10)}},@{label=”EndDate”;Expression={$_.EndDate.ToString().SubString(0,10)}},DaysLeft,EntitlementType $WarrantyObject[0,1] #Remove [0,1] to get everything } } if (($ImportFile)) { if (($ServiceTag) -OR ($ComputerName)) { Write-Warning “You can’t combine the ImportFile parameter with ServiceTag or ComputerName” } else { if (!(Test-Path -Path $ImportFile)) { Write-Warning “File not found” break } elseif (!$ImportFile.EndsWith(“.txt”)) { Write-Warning “You can only specify a .txt file” break } else { if (!$ExportCSV) { $GetServiceTagFromFile = Get-Content -Path $ImportFile foreach ($ServiceTags in $GetServiceTagFromFile) { $WarrantyObject = Get-DellWarrantyInfo -GetServiceTag $ServiceTags | Select-Object @{Label=”ServiceTag”;Expression={$ServiceTags}},@{label=”StartDate”;Expression={$_.StartDate.ToString().SubString(0,10)}},@{label=”EndDate”;Expression={$_.EndDate.ToString().SubString(0,10)}},DaysLeft,EntitlementType $WarrantyObject[0,1] #Remove [0,1] to get everything } } elseif ($ExportCSV) { $GetServiceTagFromFile = Get-Content -Path $ImportFile $ExportPath = Read-Host “Enter a path to export the results” $ExportFileName = “WarrantyInfo.csv” foreach ($ServiceTags in $GetServiceTagFromFile) { $WarrantyObject = Get-DellWarrantyInfo -GetServiceTag $ServiceTags | Select-Object @{Label=”ServiceTag”;Expression={$ServiceTags}},@{label=”StartDate”;Expression={$_.StartDate.ToString().SubString(0,10)}},@{label=”EndDate”;Expression={$_.EndDate.ToString().SubString(0,10)}},DaysLeft,EntitlementType if (!(Test-Path -Path $ExportPath)) { Write-Warning “Path not found” break } else { $FullExportPath = Join-Path -Path $ExportPath -ChildPath $ExportFileName $WarrantyObject[0,1] | Export-Csv -Path $FullExportPath -Delimiter “,” -NoTypeInformation -Append #Remove [0,1] to get everything } } (Get-Content $FullExportPath) | ForEach-Object { $_ -replace ‘”‘, “” } | Out-File $FullExportPath Write-Output “File successfully exported to $FullExportPath” } } } }

Get warranty information by service tag

1. Open a PowerShell command prompt.
2. Browse to E:\DellWarranty.
3. Run the following command line:

.\DellWarrantyInformation.ps1 -ServiceTag <your_service_tag>
37_1

Get warranty information by computer name

1. Open a PowerShell command prompt.
2. Browse to E:\DellWarranty.
3. Run the following command line:

.\DellWarrantyInformation.ps1 -ComputerName <your_computer_name>
37_2

Get warranty information from a text file with service tags

1. Create a text file and enter the service tags you want to get warranty information for. Enter each service tag on a separate line. I’ve saved the text file as ServiceTags.txt in E:\DellWarranty.
37_3
2. Open a PowerShell command prompt.
3. Browse to E:\DellWarranty.
4. Run the following command line:

.\DellWarrantyInformation.ps1 -ImportFile E:\DellWarranty\ServiceTags.txt
37_4

Export the warranty information to a CSV file

1. Open a PowerShell command prompt.
2. Browse to E:\DellWarranty.
3. Run the following command:

.\DellWarrantyInformation.ps1 -ImportFile E:\DellWarranty\ServiceTags.txt -ExportCSV

37_5
4. Enter a path to where you’d like the CSV to be exported, e.g. E:\DellWarranty.
37_6
That’s it! I hope it will help anyone to get a better overview of their warranty status.

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.

34 comments

  • Hi
    The same problem:
    New-WebServiceProxy : The request failed with HTTP status 503: Service Unavailable.

  • i am getting following error:-
    New-WebServiceProxy : The request failed with HTTP status 503: Service Unavailable.

  • Is there a benefit in hiring a pro to do the link exchanges, or would you recommend doing it in-house?
    Do you participate in any discussion boards?

  • Everything works great with this, except when I try to export to PST. I get the following error:
    Export-Csv : A parameter cannot be found that matches parameter name ‘Append’.
    At C:\Users\firefly\downloads\warranty1.ps1:89 char:122
    + $WarrantyObject[0,1] | Export-Csv -Path $FullExportPath -Delimiter “,” -NoTypeInformation -Ap
    pend <<<< #Remove [0,1] to get everything
    + CategoryInfo : InvalidArgument: (:) [Export-Csv], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.ExportCsvCommand

    • Hi Ajay,
      I’ve just updated the code in the blog post so that it should work. Let me know if it still doesn’t work for you.
      Regards,
      Nickolaj

  • Nevermind, got it:
    $Webproxy=New-WebServiceProxy -Uri ‘https://xserv.dell.com/services/AssetService.asmx?WSDL’ -UseDefaultCredential
    $WebProxy.Url = “https://xserv.dell.com/services/AssetService.asmx”

  • Is this workaround still working for folks? Can anyone post a copy of the updated script? I am still having issues.

  • I’m getting a “DLL” error after updating the URL
    $WebProxy=New-WebServiceProxy ‘https://xserv.dell.com/services/assetservice.asmx?wsdl’
    New-WebServiceProxy : Could not find file ‘C:\Users\lqa464_a\AppData\Local\Temp\4\ixmvuecv.dll’.
    At line:1 char:30
    + $WebProxy=New-WebServiceProxy <<<< 'https://xserv.dell.com/services/assetservice.asmx?wsdl&#039;
    + CategoryInfo : NotSpecified: (:) [New-WebServiceProxy], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.NewWebServiceProxy

  • Got it working again 🙂
    You just need to overwrite the URL after you connect to dell 😉
    directly after the variable $WebProxy you need to add this:
    $WebProxy.Url = ‘https://xserv.dell.com/services/AssetService.asmx’
    🙂

    • Hi Mihe,
      Sorry for not answering any of the comments on this thread, but I’ve been away on vacation. Very nice find! I’ll give it a try and see if I can get it to work as well.
      Regards,
      Nickolaj

  • Just found a fix 🙂
    you just need to overwrite the url after you set up the connection.
    so after:
    $WebProxy=New-WebServiceProxy ‘https://xserv.dell.com/services/assetservice.asmx?wsdl’
    you need to add this:
    $Webproxy.Url = “https://xserv.dell.com/services/AssetService.asmx”
    and the script will work again 🙂

  • Perhaps something to do with their CAPTCHA requirement for accessing warranty information if you are not logged into their website.

  • Yes, also all other Scripts which use this webservice wont work anymore because they bailed out with a “Host not found” error.
    Dell changed the wsdl around 7/22/2014. You can fetch and older version from the google cache and see different soap Action location which point to non public host names now 🙁

  • I haven’t been able to get a similar but of code to work either and I get the following error message:
    Exception calling “GetAssetInformation” with “3” argument(s): “The remote name could not be resolved: ‘esupport.dellsvc'”
    It seems that all the URL’s referenced when you go to the URL https://xserv.dell.com/services/assetservice.asmx are no longer valid. I think Dell removed the web service for this function, I’ve also noticed that when you trying to get Warranty Information from their support site it has a captcha requirement if you’re not signed into a Dell account

  • Hi,
    was wondering the same thing.
    Looks like Dell changed something on their end. As the request goes to ‘https://esupport.dellsvc/jigsaw/assetservice.asmx’ which is not reachable without the TLD…

  • Is this still working for everyone? All of a sudden I am getting lots of errors and wondering if dell changed something.

  • Hi.
    Thanks for this script, is their any way i can add to get model detail from service tag, kindly let me know.
    Harry

  • Hi,
    I’ve pasted this code and it works fine but is returning each tag’s warranty information twice. I’m also seeing the following error “Cannot index into a null array.
    At E:\Websites\wgk-bsys\hardware\testing\DellWarrantyInformation.ps1:73 char:37
    + $WarrantyObject[ <<<< 0,1] #Remove [0,1] to get everything
    + CategoryInfo : InvalidOperation: (System.Object[]:Object[]) [], RuntimeException
    + FullyQualifiedErrorId : NullArray"
    Any idea why that might be? I'm importing a plain txt file with tags on each line.
    Thanks,
    Noel

    • Hi Noel,
      The reason for why you’re getting the warranty information twice, is due to changes Dell made with their support contracts. From some time back, when you buy e.g. 3 years of ProSupport you’ll get one contract for 1 year and a second for 2 years. Let me look into the error you’re getting, will reply back later!
      Regards,
      Nickolaj

      • OK So I am getting the 2 lines as well. But what I am getting is different than what the Dell site says.
        As an Example: (Export File)
        2302Q22 11/1/2015 10/31/2019 1460 Future
        2302Q22 11/1/2015 10/31/2019 1460 Future
        (Website):
        Next Business Day Support UNY November 01, 2015 November 01, 2019
        ProSupport DELL November 01, 2015 November 01, 2019
        Next Business Day Support UNY October 31, 2014 November 01, 2015
        ProSupport DELL October 31, 2014 November 01, 2015
        Any Suggestions on how to properly pull this information?

    • Hi Noel,
      I just copied the script from the post and created a ‘dell.txt’ and entered two service tags. I then ran the following command line:
      .\DellWarrantyInformation.ps1 -ImportFile .\dell.txt
      I was not able to reproduce the error you got. Are you sure that the service tags you entered are complete? If you could zip together your txt file and the script file you’ve got and email it to nickolaj [at] outlook [dot] com, I’ll try to see if your problem can be replicated at my end.
      Regards,
      Nickolaj

  • this script doesn’t work for me. It throught following exeception:
    Exception calling “GetAssetInformation” with “3” argument(s): “The request failed with HTTP status 503: Service Unavail
    able.”
    At D:\Dell\DellWarrantyInformation.ps1:28 char:55
    + $WarrantyInformation=$WebProxy.GetAssetInformation <<<< (([guid]::NewGuid()).Guid,"Dell Warranty",$GetServiceTag)
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException
    Cannot index into a null array.
    At D:\Dell\DellWarrantyInformation.ps1:40 char:25
    + $WarrantyObject[ <<<< 0,1] #Remove [0,1] to get everything
    + CategoryInfo : InvalidOperation: (System.Object[]:Object[]) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

    • Hi Mike,
      I’ve experienced that Dell’s service sometimes is unavailable, as it seems your error message is telling you. I just tested the script from my lab environment at home, and it worked. Could you try again? I’m assuming that the machine you’re executing the script from has access to internet and there’s no firewall blocking it.
      Regards,
      Nickolaj

  • Any way to eliminate duplicate reports from a single ST?
    ie. I want the script to return the result with the furthest end date… this way I can have a single inventory line per ST, rather than sometimes 1 or sometimes 2.

Sponsors

Categories

MSEndpointMgr.com use cookies to ensure that we give you the best experience on our website.