cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pizzim13
Engaged Sweeper
Attached is a PowerShell script I wrote to query dbo.tblSystemEnclosure for Dell computers, pull warranty info from Dell's support site, and add it to the dbo.tblCompCustomtable, which populates the Custom fields tab in LanSweeper. This will update the purchase date, warranty date, and custom 1 field with the service type, i.e. "Next Business Day Support". I wrote this with only my environment in mind but hopefully it can help others out.
5 REPLIES 5
cpmining
Engaged Sweeper
This is an excellent script but I have a small issue.

I am running this on a Windows 7 computer as I have no access to a server at this stage (in testing phase at the moment before going live).

Also, I need a way for the script to authenticate via a proxy. If you could update the code for me that would be greatly appreciated.

The term 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\xxxxxx\Desktop\Dell_WarrLSv2.ps1:15 char:24
+ $SQLQry = Invoke-Sqlcmd <<<< -Query "SELECT SerialNumber, Computername FROM lansweeperdb.dbo.tblSystemEnclosure WHERE LEN(serialnumber) = 7 AND Manufacturer LIKE 'Dell%'"
+ CategoryInfo : ObjectNotFound: (Invoke-Sqlcmd:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
At C:\Users\biekrz3\Desktop\Dell_WarrLSv2.ps1:25 char:29
+ $HTML = $oWeb.DownloadString <<<< ($sUrl)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Jono
Champion Sweeper II
I am running LS on a Windows 2003 server; no powershell.

All I really need is something that will fill in the custom1 field with the warranty type (I'll actually change it to custom3); I have the rest already. I don't mind having the script get the rest again in order to get the warranty type, though. What can I do to run this powershell script on a server with no powershell?

Thanks,
Jono
joegasper
Engaged Sweeper
pizzim13,

Care to work your magic using the Dell web service for retrieving asset warranty info? No more screen scraping...

Run like: Dell_Wrnty_WebService.ps1 "servicetag"

Output like:

Information for Service Tag ASDF1234
Model: OptiPlex 320
Entitlement: NBD ONSITE
Provided by: Unisys
Starts: 7/12/2008
Ends: 7/12/2010
Entitlement: NBD ONSITE
Provided by: Unisys
Starts: 7/13/2007
Ends: 7/12/2008
Hemoco
Lansweeper Alumni
This might also help: http://www.lansweeper.com/forum/yaf_postst2679_Update-LS-database-with-warranty-information-from-Dells-site.aspx
pizzim13
Engaged Sweeper
If you only want to add the warranty infomation for new computers and not update the values for the entire table, change the value of $SQLQry from

$SQLQry = Invoke-Sqlcmd -Query "SELECT SerialNumber, Computername FROM lansweeperdb.dbo.tblSystemEnclosure WHERE LEN(serialnumber) = 7 AND Manufacturer LIKE 'Dell%'"

to

$SQLQry = Invoke-Sqlcmd -Query "SELECT SerialNumber, Computername FROM lansweeperdb.dbo.tblSystemEnclosure WHERE LEN(serialnumber) = 7 AND Manufacturer LIKE 'Dell%' AND Computername NOT IN (Select Computername from lansweeperdb.dbo.tblCompCustom)"