→ 🚀Are you a Lansweeper Champion?! Join our Contributor Program Sign up here!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Corbett
Engaged Sweeper
FYI: Lansweeper 5.0 which is currently in beta will have this feature build-in for Dell, HP, Lenovo


This isn't exactly a "custom action" but this topic seems the best. I wrote an application that when executed it will update the Purchase Date and Warranty Date custom fields of all Dell computers in the LS database. It accomplishes this by making an HTTP request to Dell's support site and pulling down the appropriate dates. Some assumptions are made here: The oldest date found on the support page is the purchase date and the most recent date found on the page is the warranty expiration date.

EDIT (3/21/2012): Dell changed their support site which broke the program. The program now uses the web service that Dell provides for getting warranty information. Due to this change a new line needs to be added to the .config file:

<add key="DellWarrantyURL" value="http://xserv.dell.com/services/assetservice.asmx"/>


This is a .NET application and therefore requires Framework 3.5.

Before running the program be sure to edit the .config file and set the connectionString option with the appropriate SQL Server computer name, database name, username and password.

In my situation I used the Task Scheduler to run this application once a week (UpdateDellWarrantyInfo -all) to make sure all computers have the most recent warranty information and once a day
(UpdateDellWarrantyInfo -warrantyInfo) to get the warranty information for new computers.

12/21/2009, 4:15PM ET - Added most recent version of utility.
12/24/2009, 10:50AM ET - Attached most recent version (v1.4) of utility and updated the documentation.
01/04/2010, 1:30PM ET - Fixed bug where invalid Asset Tags (AAAAAA5 for example) would throw an exception. It now just skips it and keeps going. Attached v1.5.
01/13/2010, 10:07AM ET - Added a proxy authentication mechanism (integrated authentication only), fixed a SQL statement that failed on SQL 2000, added -verbose option for troubleshooting (rewrote argument handling routines), added stack trace to error output for additional troubleshooting. Attached v1.6.
01/18/2010, 8:16AM ET - Rewrote date handling routine to better handle different date formats. Attached v1.7.
07/02/2010, 12:16PM ET - I haven't had much time to maintain this lately. Attached v1.7 of the source.
03/21/2012, 8:26AM ET - Rewrote the warranty fetch routine to use the Dell web service. Note this version now requires a DellWarrantyURL key in the .config file. Attached v2.0.

Usage: UpdateDellWarrantyInfo [options] [-verbose]

Options

-all
Will update the warranty information for all Dell computers in the Lansweeper
database.

-warrantyInfo
Will update the warranty information only for the Dell computers that have
empty warranty and purchase dates in the Lansweeper database.

-assetTag <assetTag>
Will update the warranty information for a single Dell computer based on the
asset tag. Must provide a single asset tag.

-computer <computerName>
Will update the warranty information for a single Dell computer based on the
computer name. Must provide a single computer name.

-verbose
Print troubleshooting information to the console.

-help
Will display this screen.

NOTE: If no options are provided, will update all Dell computers.
138 REPLIES 138
Interesting...
What parameters (if any) did you provide when running the app?

pvanlien wrote:
Hi corbett.

I somehow get an error listed below, any idea?

System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '('.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolea
n breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObj
ect stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cm
dHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, Tds
ParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, Run
Behavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBe
havior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav
ior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult
result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav
ior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, S
tring method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at UpdateDellWarrantyInfo.Program.Main(String[] args)

thanks in advance
asldesktop
Engaged Sweeper
The beta works fine now and I am provided with the following Dell data which is then placed into the custom fields in lansweeper.

C:\Program Files\lansweeper\>UpdateDellWarrantyInfo.exe -assetTag XXXXXY
06/01/2010 09:10:23+Query for: XXXXXY
06/01/2010 09:10:28 -Purchase Date: '7/30/2002'
06/01/2010 09:10:28 -Warranty Date: '7/30/2005'

Good job Corbett! Thanks for your help on this.

Will wait to see if it works for mrdaytrade as well?

Glad to hear it helped. I'll wait a little longer before taking it out of "beta" status.

asldesktop wrote:
The beta works fine now and I am provided with the following Dell data which is then placed into the custom fields in lansweeper.

C:\Program Files\lansweeper\>UpdateDellWarrantyInfo.exe -assetTag XXXXXY
06/01/2010 09:10:23+Query for: XXXXXY
06/01/2010 09:10:28 -Purchase Date: '7/30/2002'
06/01/2010 09:10:28 -Warranty Date: '7/30/2005'

Good job Corbett! Thanks for your help on this.

Will wait to see if it works for mrdaytrade as well?

Corbett
Engaged Sweeper
The documentations says I shouldn't have to do this but let's try adding this line:
objRequest.Proxy = System.Net.WebRequest.DefaultWebProxy;


This assumes the proxy server is correctly configured in IE and we will use those settings.

Would you mind trying this for me?
mrdaytrade
Engaged Sweeper III
It did not work for me. I got the same error as before.

The remote server returned an error: (407) Proxy Authentication Required...
Corbett
Engaged Sweeper
I added the following line that should use the current credentials to authenticate to the proxy server.
objRequest.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;


I don't have a proxy server. Can you try it out for me please?
asldesktop
Engaged Sweeper
Thanks for the quick reply Corbett......

I am using a user that will be an authenticated user that has access to the proxy server and then out to the internet.
Corbett
Engaged Sweeper
I'm all for trying to make it work with a proxy server. I don't have proxies here so there may be a little trial and error before we get it working. Are you running the application as an authenticated user that has access to the proxy or do you need to specify alternate credentials via the .config file?
mrdaytrade
Engaged Sweeper III
For our network, we require proxy server authentication to access the internet. How would I go about setting my username and password for the proxy? When I run the program, I get the following error:

The remote server returned an error: (407) Proxy Authentication Required
asldesktop
Engaged Sweeper
Great application....

Having trouble getting it to work in our environment due to using a proxy server.

Get the following error

05/01/2010 14:47:40+Query for: Asset Tag Name
System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.
at System.Net.HttpWebRequest.GetResponse()
at UpdateDellWarrantyInfo.warrantyInfo..ctor(String URL, String ServiceTag)
05/01/2010 14:47:40 -Purchase Date: null
05/01/2010 14:47:40 -Warranty Date: null

Do you have anyway it can work with a proxy server?

Thanks