dotps1 / HPWarranty

PowerShell module to help retrieve Hewlett-Packard Warranty Information
https://www.powershellgallery.com/packages/HPWarranty/
43 stars 17 forks source link

everything works except the sccm lookup #17

Closed skunnit closed 9 years ago

skunnit commented 9 years ago

i keep getting this error using the get-systeminformationfromCMDB:

Exception calling "ExecuteReader" with "0" argument(s): "Invalid object name 'MS_SYSTEMINFORMATION_DATA'." At C:\Program Files\WindowsPowerShell\Modules\HPWarranty\2.2.0.2\Functions\Get-HPSystemInformationFromCMDB.ps1:81 char:5

You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\HPWarranty\2.2.0.2\Functions\Get-HPSystemInformationFromCMDB.ps1:101 char:5

dotps1 commented 9 years ago

sorry, I forgot to add back to KB after this refactor. That WMI Class is NOT inventoried by default, you need set you SCCM Client to pull in this class. I will update the WIKI and README to reflect this.

thank you.

dotps1 commented 9 years ago

Ok, I actually added a check to the Get-HPSystemInformationFromCMDB to ensure that the table is inventoried, if its not, it will throw a more informative error.

PS C:\> Get-HPSystemInformationFromCMDB -SqlServer SCCM -Database CM_1AB -IntergratedSecurity
Get-HPSystemInformationFromCMDB : The table MS_SYSTEMINFORMATION_DATA does not exist.
At line:1 char:1
+ Get-HPSystemInformationFromCMDB -SqlServer H101VSCCM001 -Database CM_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (0:Int32) [Write-Error], Exception
    + FullyQualifiedErrorId : System.Exception,Get-HPSystemInformationFromCMDB

PS C:\> $Error[0].ErrorDetails.RecommendedAction
The MS_SYSTEMINFORMATION_DATA must be inventoried with the SCCM Client to use this cmdlet.

Thanks for the info.