Jump to content
DarrenDK

Computer Warranty Updater (HP/Dell/Lenovo)

Recommended Posts

Getting the following while running HP portion:

Update-WarrantyInLabTech : Cannot process argument transformation on parameter 'EndDate'. Cannot convert null to type "System.DateTime".
At line:247 char:104
+ ... terID -ShipDate $WarrantyInfo.ShipDate -EndDate $WarrantyInfo.EndDate
+                                                     ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Update-WarrantyInLabTech], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Update-WarrantyInLabTech

 

UPDATE

Changed last line in Update-MissingHPWarranties to this:

Update-WarrantyInLabTech -ComputerID $ComputerID -ShipDate $WarrantyInfo.ShipDate -EndDate $WarrantyInfo.WarrantyEnd #EndDate

Now get error 

Exception calling "Fill" with "2" argument(s): "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 
'{BiosVer=2UAXXXXXX}' at line 1"
At C:\Program Files\WindowsPowerShell\Modules\LabTech\LabTech.psm1:67 char:5
+     $RecordCount = $dataAdapter.Fill($dataSet, "data")
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : MySqlException

 

 

Edited by jamberston
additional information

Share this post


Link to post
Share on other sites

I'm experiencing the same problem. The Lenovo and Dell updaters work great though.

@DarrenDK appreciate you've shared your personal script, but you around?

Share this post


Link to post
Share on other sites

First, thank you for sharing this script.  We were dependent on WarrantyMaster until they pulled their pricing heist which increased our cost 38%/month. 

I too am getting errors on the HP call.  I am using PS v4

Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
At line:179 char:21
+     $AuthResponse = Invoke-RestMethod -Method Post -Uri $uri -headers $headers - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
 
 

Any help is much appreciated.

Edited by shanna

Share this post


Link to post
Share on other sites

Hey guys,

The HP issues should be fixed. I've also embedded the Lenovo logic into the script so the Lenovo module doesn't need to be installed anymore. You still need my LabTech module.

Please reference the initial post, I have edited it to have the latest versions.

Let me know if this helps!

Edited by DarrenDK
Clarity

Share this post


Link to post
Share on other sites

I just posted another update that should fix the HP thing once and for all. It's going to update HP warranties in chunks of 25.

Share this post


Link to post
Share on other sites
3 hours ago, DarrenDK said:

I just posted another update that should fix the HP thing once and for all. It's going to update HP warranties in chunks of 25.

Looks like something went wrong with attaching the file, it's coming in at 0Kb.

Share this post


Link to post
Share on other sites
Quote

I just posted another update that should fix the HP thing once and for all. I don't have a huge sample set of HPs to test with

Try now

Edited by DarrenDK

Share this post


Link to post
Share on other sites

Hi,

Great work on this script! I'm having a problem which I wonder if anyone else has had. When I run though ISE on the server the first 25 HP serials go through, but all of them after that return an error:

Quote

Invoke-RestMethod : The operation has timed out
At line:388 char:20
+     $JobResponse = Invoke-RestMethod -Method Post -body (ConvertTo-Json $HPSNs)  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : System.Net.WebException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

It just cycles then, picks up the next serials but then gives me the same error.

Any ideas?

 

Share this post


Link to post
Share on other sites

@DarrenDK this looks to be an awesome script, and a well written howto! Thank you.

I am however having some issues when I run it, and results are not making it into manage.

When the script runs, it comes back with the following in the log:

# Warranty Lookup Result 
Trimming SerialNumbers
Updating Dell Warranties
% : You cannot call a method on a null-valued expression.
At C:\Windows\Temp\2e98f56d-fe14-11e8-afa9-00155d006e00.ps1:257 char:45
+     $Warranties = $XML.AssetWarrantyResponse | %{
+                                                ~~
    + CategoryInfo          : InvalidOperation: (:) [ForEach-Object], RuntimeE 
   xception
    + FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands 
   .ForEachObjectCommand
 

Any ideas on what I could be doing wrong?

 

I also noticed the function script (ImmyBot\Function Scripts - Core\Run-PowershellOnLTServer) refers to immense.net. 
What is the function doing when it does this and is it necessary to run?

Share this post


Link to post
Share on other sites
2 hours ago, Dave M said:

@DarrenDK this looks to be an awesome script, and a well written howto! Thank you.

I am however having some issues when I run it, and results are not making it into manage.

When the script runs, it comes back with the following in the log:


# Warranty Lookup Result 
Trimming SerialNumbers
Updating Dell Warranties
% : You cannot call a method on a null-valued expression.
At C:\Windows\Temp\2e98f56d-fe14-11e8-afa9-00155d006e00.ps1:257 char:45
+     $Warranties = $XML.AssetWarrantyResponse | %{
+                                                ~~
    + CategoryInfo          : InvalidOperation: (:) [ForEach-Object], RuntimeE 
   xception
    + FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands 
   .ForEachObjectCommand
 

Any ideas on what I could be doing wrong?

 

I also noticed the function script (ImmyBot\Function Scripts - Core\Run-PowershellOnLTServer) refers to immense.net. 
What is the function doing when it does this and is it necessary to run?

Hey Matt, I removed immense.net, it was unnecessary. 

The purpose of that script is what it says, to run PowerShell on the LT server. As you can see, the logic is written in PowerShell and needs a place to execute. I couple that with my custom labtech PowerShell module, and it allows me to interact with the database in PowerShell rather than within the rather clumsy LT scripting language.

With regards to your specific issue, it looks like for whatever reason the Dell API didn't return a result. Perhaps the service tag(s) it was passing in were invalid?

Edited by DarrenDK

Share this post


Link to post
Share on other sites
On 12/12/2018 at 12:08 PM, DarrenDK said:

Hey Matt, I removed immense.net, it was unnecessary. 

The purpose of that script is what it says, to run PowerShell on the LT server. As you can see, the logic is written in PowerShell and needs a place to execute. I couple that with my custom labtech PowerShell module, and it allows me to interact with the database in PowerShell rather than within the rather clumsy LT scripting language.

With regards to your specific issue, it looks like for whatever reason the Dell API didn't return a result. Perhaps the service tag(s) it was passing in were invalid?

Thank you! 

Unfortunately I'm still not having any luck.

I ran the script on the server with ISE and I get the below errors. Any pointers in the right direction is appreciated.

#Get-DellWarrantyInfo -ServiceTag @("*******","*******") -APIKey $DellAPIKey2015
Trimming SerialNumbers
Updating Dell Warranties
You cannot call a method on a null-valued expression.
At line:259 char:8
+        New-Object psobject -Property @{"WarrantyEndDate"=[DateTime]:: ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At line:259 char:8
+        New-Object psobject -Property @{"WarrantyEndDate"=[DateTime]:: ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At line:259 char:8
+        New-Object psobject -Property @{"WarrantyEndDate"=[DateTime]:: ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Updating ComputerID: 92 ShipDate: 12/07/2018 00:00:00 EndDate: 12/06/2021 00:00:00
Updating ComputerID: 91 ShipDate: 12/07/2018 00:00:00 EndDate: 12/06/2021 00:00:00
Updating Lenovo Warranties
Submitting  computers to Lenovo API: *******
Update-WarrantyInLabTech : A parameter cannot be found that matches parameter name 'EndDate'.
At line:348 char:84
+ ... abTech -ComputerID $_.ComputerID -ShipDate $ShipDate -EndDate $EndDat ...
+                                                          ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Update-WarrantyInLabTech], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Update-WarrantyInLabTech

I also checked Computers with ID 92 and 92, and they do not have the information populated in manage.

Edited by Dave M

Share this post


Link to post
Share on other sites
7 hours ago, Dave M said:

Thank you! 

Unfortunately I'm still not having any luck.

I ran the script on the server with ISE and I get the below errors. Any pointers in the right direction is appreciated.


#Get-DellWarrantyInfo -ServiceTag @("*******","*******") -APIKey $DellAPIKey2015
Trimming SerialNumbers
Updating Dell Warranties
You cannot call a method on a null-valued expression.
At line:259 char:8
+        New-Object psobject -Property @{"WarrantyEndDate"=[DateTime]:: ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At line:259 char:8
+        New-Object psobject -Property @{"WarrantyEndDate"=[DateTime]:: ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At line:259 char:8
+        New-Object psobject -Property @{"WarrantyEndDate"=[DateTime]:: ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Updating ComputerID: 92 ShipDate: 12/07/2018 00:00:00 EndDate: 12/06/2021 00:00:00
Updating ComputerID: 91 ShipDate: 12/07/2018 00:00:00 EndDate: 12/06/2021 00:00:00
Updating Lenovo Warranties
Submitting  computers to Lenovo API: *******
Update-WarrantyInLabTech : A parameter cannot be found that matches parameter name 'EndDate'.
At line:348 char:84
+ ... abTech -ComputerID $_.ComputerID -ShipDate $ShipDate -EndDate $EndDat ...
+                                                          ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Update-WarrantyInLabTech], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Update-WarrantyInLabTech

I also checked Computers with ID 92 and 92, and they do not have the information populated in manage.

I'm not at a computer right now, but I'm sure I had the same issue and it was because either one on the parameters or variables (can't remember which one) was named EndDate instead of WarrantyEnd (or whatever it should have been). If you don't find it by the time I'm back I'll post an update with the affected line number.

Share this post


Link to post
Share on other sites

I updated 348 to "Update-WarrantyInLabTech -ComputerID $_.ComputerID -ShipDate $ShipDate -WarrantyEndDate $EndDate". and I now get:
 

Updating Lenovo Warranties
Submitting  computers to Lenovo API: PF0ZZLCL
Updating ComputerID: 54 ShipDate: 03/06/2018 00:00:00 EndDate: 05/13/2019 00:00:00
Updating HP Warranties

However it is still not showing anything in Manage.

I'm also still getting the error on line:259 char:8, which is expected as nothing has changed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×