11-21-2019 11:12 AM
Solved! Go to Solution.
02-21-2020 01:52 PM
$assets = Invoke-Sqlcmd -ServerInstance servername -Database lansweeperdb -Username lansweeperuser -Password 'password' -Query @"
SELECT a.AssetID, a.AssetName, b.Serialnumber, b.SystemSKU
FROM lansweeperdb.dbo.tblAssets a, lansweeperdb.dbo.tblAssetCustom b
WHERE a.AssetID = b.AssetID AND
a.Assettype = -1 AND
b.Warrantydate is NULL AND
b.Manufacturer in ('HP','Hewlett-Packard');
"@
foreach ($asset in $assets) {
$assetId = $asset.AssetID
$assetName = $asset.AssetName
$warranty = ((Get-HPIncWarrantyEntitlement -SerialNumber $asset.SerialNumber -ProductNumber $asset.SystemSKU).OverallEntitlementEndDate | Measure-Object -Maximum).Maximum
Write-Output "$assetID $assetName $warranty"
Invoke-Sqlcmd -ServerInstance servername -Database lansweeperdb -Username lansweeperuser -Password 'password' -Query @"
UPDATE dbo.tblAssetCustom
SET Warrantydate = '$warranty'
WHERE assetID = $assetId
"@
}
01-04-2021 01:47 PM
10-24-2020 04:13 PM
11-09-2020 07:47 PM
TBMPS wrote:
Trying out the script in #12. However it is only putting the date "1900-01-01" in the warranty. When I run the script, there is no error. Is there something that might need to be done to get this to work correctly, or has this script been shutdown too?
Thanks.
08-10-2020 10:18 PM
08-10-2020 05:56 PM
08-10-2020 02:12 PM
07-08-2020 10:31 PM
07-02-2020 01:55 PM
07-01-2020 04:47 AM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now