Purpose: This script will read serial numbers from a text file then search dells site for warranty information. The get-dellassetinfo function i found from some forum but don't remember where.
################################### $ComputerSerials = gc "c:\temp\SerialNumbers.txt" ################################### Function Get-DellAssetInfo([string]$ServiceTag){ $Asset=New-WebServiceProxy -Uri 'http://xserv.dell.com/services/AssetService.asmx?WSDL' -UseDefaultCredential $Asset.GetAssetInformation([Guid]::NewGuid(),'AssetService',$ServiceTag); } $myCol = @() foreach ($ComputerSerial in $ComputerSerials) { $results=Get-DellAssetInfo $ComputerSerial $SystemType = $results.AssetHeaderData.SystemType $ServiceLevelDescription = $results.Entitlements.ServiceLevelDescription $SystemModel = $results.AssetHeaderData.SystemModel $Region = $results.AssetHeaderData.Region $StartDate = $results.Entitlements.StartDate.Date | Select -ExpandProperty DateTime $EndDate = $results.Entitlements.EndDate.Date | Select -ExpandProperty DateTime Write-Host "Writing $ComputerName info" $x = 0 foreach ($Sdate in $StartDate) { $Detail = New-Object PSObject $Detail | Add-Member Noteproperty ComputerName $ComputerName $Detail | Add-Member Noteproperty Serial $ComputerSerial $Detail | Add-Member Noteproperty Manufacturer $ComputerManufacturer $Detail | Add-Member Noteproperty SystemType $SystemType $Detail | Add-Member Noteproperty SystemModel $SystemModel $Detail | Add-Member Noteproperty Region $Region $Detail | Add-Member Noteproperty ServiceLevelDescription $ServiceLevelDescription.get_Item($x) $Detail | Add-Member Noteproperty StartDate $Sdate $Detail | Add-Member Noteproperty EndDate $EndDate.get_Item($x) $x++ $myCol += $Detail } } $myCol | Export-Csv -Path c:\temp\AD_WarrentyComputerSerialNumbers.csv -notype
No comments:
Post a Comment