I want to kick off a full inventory. From what I can tell this should be working, yet it isn't.
I run a wmi query against ccm\invagt I can see an entry for
'InventoryActionStatus.InventroyActionID="{00000000-0000-0000-0000-000000000001}"
I then run this command (via PowerShell) and I can see via the wmi query that
the entry gets deleted.
$Computer = "xyz"
[wmi]"\\$Computer\ROOT\ccm\invagt:InventoryActionStatus.InventoryActionID='{00000000-0000-0000-0000-000000000001}'"
| remove-wmiobject
I then run this command:
([wmiclass]"\\$Computer\Root\CCM:SMS_Client").TriggerSchedule('{00000000-0000-0000-0000-000000000001}')
I don't see an entry in wmi for the scheduled task (inventory) like I did
before I issued the remove command.
In the InventoryAgent.log on machine XYZ I see this:
Inventory: Message [Type=InventoryAction,
ActionID={00000000-0000-0000-0000-000000000001}, Report=Delta] already in
queue. Message ignored. InventoryAgent 6/10/2013
10:13:07 AM 6780 (0x1A7C)
Which is a 'Delta' inventory.
Shouldn't the 'remove' command remove any scheduled inventory task, and the
TriggerSchedule command in turn force a full inventory? At least that is how I
understand this should work. Do I understand this wrong or is there an issue
with the PowerShell script I'm trying to run?
Thanks,
Ken ...
From: [email protected] [mailto:[email protected]] On
Behalf Of Lutz, Ken
Sent: Thursday, June 06, 2013 3:33 PM
To: [email protected]
Subject: [mssms] RE: PowerShell script help
Thanks, Daniel.
I'll give that a try. Since it's "Miller" time I'll have to try this on Monday.
Thanks,
Ken ...
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Daniel Ratliff
Sent: Thursday, June 06, 2013 3:06 PM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] RE: PowerShell script help
Wmic isn't PowerShell, it's a built in windows command. You will have to turn
that string into a command so that it can use your $computer variable.
Invoke-command or start-process should do the trick.
Daniel Ratliff
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Lutz, Ken
Sent: Thursday, June 06, 2013 6:03 PM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] RE: PowerShell script help
Brandon,
Thanks for the reply
When I try to put the $Computer variable into the command it fails.
$Computer = "XYZ"
WMIC /namespace:\\$Computer\root\ccm\invagt path inventoryActionStatus where
InventoryActionID="{00000000-0000-0000-0000-000000000001}" DELETE /NOINTERACTIVE
I'm having problems getting the command to work with the variable value. I
want the variable so that I can next create a text file of machine names and
send that to the script.
What my objective is to have this script read the mif files that show up in the
dataloader inbox badmifs folders and pars out the computer name and force a
full inventory. The above is just the first part of my attempt to get this
script working while leaning PowerShell at the same time. Part of my problem
is that I don't have a programming or scripting background, so I have a lot to
learn.
Thanks,
Ken ...
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
On Behalf Of Brandon Linton
Sent: Thursday, June 06, 2013 2:38 PM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] RE: PowerShell script help
Below is the wmic command to force a full HW Inventory.
WMIC /namespace:\\root\ccm\invagt path inventoryActionStatus where
InventoryActionID="{00000000-0000-0000-0000-000000000001}" DELETE /NOINTERACTIVE
Thanks,
Brandon A. Linton | Sr. Consultant |
[email protected]<mailto:[email protected]> | Work 484.323.7205
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Lutz, Ken
Sent: Thursday, June 6, 2013 5:21 PM
To: SMS List
Subject: [mssms] PowerShell script help
I'm trying to learn PowerShell and this script is what I was hoping would be a
good place to start. I want to be able to input a list of computers and then
kick off a full Hardware or Software inventory (rather than a delta inventory).
So far I have it kicking off a delta inventory. I don't see a way to do a full
inventory.
Here is what I have so far (this is just the inventory portion for testing):
$Computer = "XYZ"
[wmi]"\\$Computer\ROOT\ccm\invagt:InventoryActionStatus.InventoryActionID='{00000000-0000-0000-0000-000000000001}'<file:///\\$Computer\ROOT\ccm\invagt:InventoryActionStatus.InventoryActionID='%7b00000000-0000-0000-0000-000000000001%7d'>"
| remove-wmiobject
([wmiclass]"\\$Computer\Root\CCM:SMS_Client<file:///\\$Computer\Root\CCM:SMS_Client>").TriggerSchedule('{00000000-0000-0000-0000-000000000001}')
When I run this I get the following in the InventoryAgent.log file:
[cid:[email protected]]
Thanks,
[cid:[email protected]]
Ken Lutz
Senior Systems Administrator
Information Systems Department
Spokane County
815 N. Jefferson
Spokane, Washington 99260
The information transmitted is intended only for the person or entity to which
it is addressed
and may contain CONFIDENTIAL material. If you receive this material/information
in error,
please contact the sender and delete or destroy the material/information.
<<inline: image001.png>>
<<inline: image002.png>>

