A Custom Inventory for Windows 7.x Powershell script is not creating the nsi or nse files. The database is not being populated with expected results.
Custom inventory for Windows 7.x includes Altiris.AeXNSEvent.dll. This class is a variant. Powershell 1.0 does not support variant data types so the powershell script is failing. This can be seen when running the script from a PowerShell CLI on a machine with the Altiris.AeXNSEvent.dll class registered.
Error returned by powershell:
Exception calling "AddDataBlock" with "1" argument(s): "Object is not a resource" At C:\mystuff\incidents\281-624-055\get_lastlogon.ps1:17 char:34 + $objDataClass = $nse.AddDataBlock( <<<< $objDCInstance)
There are two possible resolutions to this situation:
1. Upgrade to Powershell 2.0.
2. Write the scripts in VBScript rather than Powershell. Once upgrades to Powershell 2.0 are completed, the scripts can easily be converted to Powershell scripts.
Note: Powershell 2.0 installs as part of the Windows Management Framework to the old powershell 1.0 directory. So, when the PS window is open, it still shows the titlebar path as c:\windows\system32\windowspowershell\1.0\powershell.exe. To check the currently installed version, run either of the following two commands from a PS prompt:
Applies To Inventory for Windows 7.x PowerShell 1.0
Imported Document ID: TECH42208
Subscribing will provide email updates when this Article is updated. Login is required.