Skip to content

Instantly share code, notes, and snippets.

@mortenson
Created March 13, 2013 23:22
Show Gist options
  • Save mortenson/9aa0b4f1228f4c3a8e66 to your computer and use it in GitHub Desktop.
Save mortenson/9aa0b4f1228f4c3a8e66 to your computer and use it in GitHub Desktop.
$service = New-WebServiceProxy -Uri http://143.166.84.118/services/assetservice.asmx?WSDL
if($args.count -ne 0){
$serial = $args[0]
}
else{
$system = Get-WmiObject win32_SystemEnclosure
$serial = $system.serialnumber
}
$guid = [guid]::NewGuid()
$info = $service.GetAssetInformation($guid,'check_warranty.ps1',$serial)
if($info.count -eq 0)
{
Write-Host "Machine is not a Dell"
}
else
{
$warranty = $info[0].Entitlements[0]
$expires = $warranty.EndDate
$days_left = $warranty.DaysLeft
if($days_left -eq 0)
{
Write-Host "Warranty has expired"
}
else{
Write-Host "Warranty expires $expires."
Write-Host "Warranty is valid for $days_left days."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment