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 "http://xserv.dell.com/services/AssetService.asmx?WSDL" -UseDefaultCredential
    $WebProxy.Url = "http://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
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.

(342)

comments
  • Steve
    Posted at 19:19 October 29, 2013
    Steve
    Reply
    Author

    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.

  • Ed
    Posted at 18:06 December 9, 2013
    Ed
    Reply
    Author

    +1 Steve. I would also love a way for it to return the furthest end date.

  • Mike
    Posted at 09:51 January 9, 2014
    Mike
    Reply
    Author

    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

    • Nickolaj
      Posted at 11:23 January 9, 2014
      Nickolaj
      Reply
      Author

      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

  • Noel
    Posted at 16:57 January 21, 2014
    Noel
    Reply
    Author

    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

    • Nickolaj
      Posted at 07:21 January 22, 2014
      Nickolaj
      Reply
      Author

      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

      • Harold Roberts
        Posted at 18:42 July 21, 2015
        Harold Roberts
        Reply
        Author

        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?

    • Nickolaj
      Posted at 08:44 January 22, 2014
      Nickolaj
      Reply
      Author

      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

  • Harry
    Posted at 12:23 May 13, 2014
    Harry
    Reply
    Author

    Hi.

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

    Harry

  • Steve
    Posted at 15:50 July 21, 2014
    Steve
    Reply
    Author

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

  • Harry
    Posted at 15:24 July 24, 2014
    Harry
    Reply
    Author

    Hi, I was user this powershell script, it was working till last week, But from last monday i am getting big error message, Please looking into this and reply back.

    Harikiran.kc@synopsys.com

    Harry

  • Harry
    Posted at 08:53 July 25, 2014
    Harry
    Reply
    Author

    Hi can any one update why this is not working now.

    Harry

  • mihe
    Posted at 13:57 July 29, 2014
    mihe
    Reply
    Author

    Hi,

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

  • Len
    Posted at 17:46 July 29, 2014
    Len
    Reply
    Author

    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 http://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

  • Joerg Behrens
    Posted at 18:14 July 30, 2014
    Joerg Behrens
    Reply
    Author

    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 🙁

  • Len
    Posted at 20:32 July 30, 2014
    Len
    Reply
    Author

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

  • mihe
    Posted at 14:15 August 8, 2014
    mihe
    Reply
    Author

    Just found a fix 🙂

    you just need to overwrite the url after you set up the connection.

    so after:
    $WebProxy=New-WebServiceProxy ‘http://xserv.dell.com/services/assetservice.asmx?wsdl’

    you need to add this:
    $Webproxy.Url = “http://xserv.dell.com/services/AssetService.asmx”

    and the script will work again 🙂

  • mihe
    Posted at 08:02 August 11, 2014
    mihe
    Reply
    Author

    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 = ‘http://xserv.dell.com/services/AssetService.asmx’

    🙂

    • Nickolaj
      Posted at 12:56 August 12, 2014
      Nickolaj
      Reply
      Author

      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

  • Stephen
    Posted at 20:16 August 22, 2014
    Stephen
    Reply
    Author

    I’m getting a “DLL” error after updating the URL

    $WebProxy=New-WebServiceProxy ‘http://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 <<<< 'http://xserv.dell.com/services/assetservice.asmx?wsdl&#039;
    + CategoryInfo : NotSpecified: (:) [New-WebServiceProxy], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.NewWebServiceProxy

  • Stephen
    Posted at 20:17 August 22, 2014
    Stephen
    Reply
    Author

    Never mind… I closed and opened the PS window and it worked… Doh!

    • Nickolaj
      Posted at 16:21 September 8, 2014
      Nickolaj
      Reply
      Author

      Hi Stephen,

      Sorry for the late reply. I’m glad that you were able to sort it out 🙂

      Regards,
      Nickolaj

  • Stephen Dion
    Posted at 22:18 September 3, 2014
    Stephen Dion
    Reply
    Author

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

  • Stephen Dion
    Posted at 00:15 September 4, 2014
    Stephen Dion
    Reply
    Author

    Nevermind, got it:

    $Webproxy=New-WebServiceProxy -Uri ‘http://xserv.dell.com/services/AssetService.asmx?WSDL’ -UseDefaultCredential
    $WebProxy.Url = “http://xserv.dell.com/services/AssetService.asmx”

  • Ravi
    Posted at 13:48 October 21, 2014
    Ravi
    Reply
    Author

    How can I run this against multiple computers from a text file?

  • Ajay
    Posted at 16:38 December 1, 2014
    Ajay
    Reply
    Author

    I’m trying to run however its closed automatically.

    • Nickolaj
      Posted at 17:03 December 1, 2014
      Nickolaj
      Reply
      Author

      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

  • Adam Jones
    Posted at 23:19 March 2, 2015
    Adam Jones
    Reply
    Author

    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

  • G. Summer
    Posted at 02:19 March 5, 2015
    G. Summer
    Reply
    Author

    Hi there. first off, thanks for the script, it was a lifesaver. However, I made a modified version of your script to give out the model instead of warranty for those who need that function (I did). I think if you play around with For-Each, you can the script to do both. Here’s the link:

    http://girardsummer.blogspot.com/2015/03/get-model-information-for-dell-pcs-via.html

    • Nickolaj
      Posted at 12:49 March 11, 2015
      Nickolaj
      Reply
      Author

      Hi G. Summer,

      Thank you for sharing your contribution to this script, it’s highly appreciated!

      Regards,
      Nickolaj

  • Niklas
    Posted at 11:36 January 8, 2016
    Niklas
    Reply
    Author

    Hi, I get double output of the servicetags i enter.
    Do you know why?

  • Karen
    Posted at 19:33 May 29, 2016
    Karen
    Reply
    Author

    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?

  • Chandan
    Posted at 16:54 June 7, 2016
    Chandan
    Reply
    Author

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

  • Arkady
    Posted at 19:51 June 11, 2016
    Arkady
    Reply
    Author

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

  • Leave a Reply