PowerShell: How do I trigger SMS 2003 Inventory Actions?
The following is a continuation of: http://myitforum.com/cs2/blogs/scassells/archive/2008/05/20/powershell-sms-2003-configmgr-2007-scripting.aspx
COM object for the SMS 2003 control panel API
$a = New-Object -comobject cpapplet.cpappletmgr
Expose the member variables via Get-Member or GM $a | gm
| Name |
MemberType |
Definition |
| GetClientActions |
Method |
IClientActions GetClientActions () |
| GetClientComponents |
Method |
IClientComponents GetClientComponents () |
| GetClientProperties |
Method |
IClientProperties GetClientProperties () |
$a.GetClientActions() | Format-table ActionID, Name
| ActionID |
Name |
| {00000000-0000-0000-0000-000000000102} |
Software Inventory Collection Cycle |
| {00000000-0000-0000-0000-000000000107} |
MSI Product Source Update Cycle |
| {00000000-0000-0000-0000-000000000101} |
Hardware Inventory Collection Cycle |
| {00000000-0000-0000-0000-000000000104} |
Standard File Collection Cycle |
| {00000000-0000-0000-0000-000000000103} |
Discovery Data Collection Cycle |
| {3A88A2F3-0C39-45fa-8959-81F21BF500CE} |
Request & Evaluate User Policy |
| {8EF4D77C-8A23-45c8-BEC3-630827704F51} |
Request & Evaluate Machine Policy |
| {00000000-0000-0000-0000-000000000106} |
Software Metering Usage Report Cycle |
What are the members for GetClientActions()?
$a.GetClientActions() | gm
| Name |
MemberType |
Definition |
| PerformAction |
Method |
void PerformAction () |
| ActionID |
Property |
string ActionID () {get} |
| DisplayNameResDLL |
Property |
string DisplayNameResDLL () {get} |
| DisplayNameResID |
Property |
int DisplayNameResID () {get} |
| Name |
Property |
string Name () {get} |
To Trigger these actions:
Perform a software inventory:
$a.GetClientActions() |? {$_.name -like 'Soft*Inv*'} |% {$_.PerformAction()}
Perfom a Hardware Inventory: (no shortcuts)
(New-Object –COMObject CPApplet.cpappletmgr).GetClientActions() |? {$_.Name –like ‘Hardware*’} |% {$_.PerformAction()}