myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


SMS Program History from WMI

 
Logged in as: Guest
  Printable Version
All Forums >> [Management Products] >> System Center Products >> System Center Configuration Manager >> SMS Program History from WMI Page: [1]
Login
Message << Older Topic   Newer Topic >>
SMS Program History from WMI - 3/24/2009 7:43:15 PM   
sserebrennikov

 

Posts: 5
Score: 0
Joined: 3/24/2009
Status: offline
Hello,

I am trying to query Advanced Client's wmi provider to show execution history / state of advertised program. I can get a lot of information on the package/advertisement/program from CCM_SoftwareDistribution in root/ccm/policy/machine/actualconfig, but these policies do not show history. I also looked at CCM_Scheduler_ScheduledMessage and CCM_Scheduler_History, but did not find anything there as well.

SMS View and SMS Client Center show "State" of advertisement/program. Where do they get that information? I know that I can look up execution history in the registry on the adv client, but question is where to look with WMI.

Any reference is greatly appreciated.

Thank you.
Post #: 1
RE: SMS Program History from WMI - 3/24/2009 10:05:24 PM   
jsandys


Posts: 925
Score: 99
Joined: 3/24/2005
From: San Antonio, TX
Status: offline
The SDK has complete details of most things behind the scenes for ConfigMgr: http://msdn.microsoft.com/en-us/library/cc145334.aspx. Although I don't think that you are going to find what you want in WMI. Not everything has to be or is stored or accesible using WMI. I'm pretty sure, as you've pointed out, that it's only in the registry.

_____________________________

Jason
Configuration Manager MVP
My Blog
Twitter @JasonSandys

(in reply to sserebrennikov)
Post #: 2
RE: SMS Program History from WMI - 3/25/2009 8:32:03 AM   
sserebrennikov

 

Posts: 5
Score: 0
Joined: 3/24/2009
Status: offline
Thanks for your help.

I was looking at the SDK. It has a lot of reference to program history locations in the server database, accessible via WMI. For the client, however, I was able to find that CCM_Software_Distribution class has a property called PRG_HistoryLocation, which tells you location of history. SDK description is:

PRG_HistoryLocation Data type: string
Access type: Read
Location to check or record history for this program. Possible values are:
User — If the program can run only when a user is logged on, and the behavior of the program when targeted at a computer is to run once for every user, then this program is a per-user program and the user's history should be checked.
Machine — In all other cases, the program is a per-computer program. In most cases, I am seeing this set to "Machine".

Question is where to look for "User's" history or "Machine" history records. In the user or machine hives? Is that the only place? Looks like it might be.







(in reply to sserebrennikov)
Post #: 3
RE: SMS Program History from WMI - 3/25/2009 8:57:10 AM   
mhudson

 

Posts: 694
Score: 26
Joined: 4/1/2007
From: College Station, TX
Status: offline
If you are looking at a specific client you can also look at the registry for that client
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client\Software Distribution\Execution History
then read the keys and you see info such as:
ProgramID
Run start time
State
successorfailurecode
SuccessorfailureReason

_____________________________

Matthew Hudson MCTS,MVP-ConfigMgr
http://sms-hints-tricks.blogspot.com/
http://www.sccm-tools.com

(in reply to sserebrennikov)
Post #: 4
RE: SMS Program History from WMI - 3/26/2009 8:37:57 AM   
sserebrennikov

 

Posts: 5
Score: 0
Joined: 3/24/2009
Status: offline
I pulled execution history from the registry. But I also need to see "running" executions. It looks like execution history is only generated after execution is complete? Is that true? Where can I see "running" executions?

I used policy spy to check requested ccm_softwaredistribution policies. Policy for the execution exists, but there is no "state" to see that this execution is currently running. I also checked CCM_Scheduler_ScheduledMessage instances, but they don't seem to report "state" as well.

How can I see which executions are currently running on the client?

Thank you for your responses.

(in reply to mhudson)
Post #: 5
RE: SMS Program History from WMI - 3/26/2009 8:42:49 AM   
mhudson

 

Posts: 694
Score: 26
Joined: 4/1/2007
From: College Station, TX
Status: offline
Yes, this is the completed execution.  We have a tool that checks the status of the machines.  We bypass WMI and hook directly to the database.  You can just about run the SQL report for Adv Status for a given machine.  This will tell you the programID, packageId...and the state "running, failed and so forth"

What and how are you trying to use this data?

_____________________________

Matthew Hudson MCTS,MVP-ConfigMgr
http://sms-hints-tricks.blogspot.com/
http://www.sccm-tools.com

(in reply to sserebrennikov)
Post #: 6
RE: SMS Program History from WMI - 3/26/2009 9:04:22 AM   
sserebrennikov

 

Posts: 5
Score: 0
Joined: 3/24/2009
Status: offline

We are developing an ASP.NET application that will allow helpdesk to push selected software to desktops. Application performs different checks on the client prior to deployment, so there is a smaller chance of failed distribution. It also displays prior executions (I am getting those from the registry now), and should display running executions, in case helpdesk pushes software and wants to monitor its completion. (or if software has already been pushed, and is currently executing, in which case it will not show in the Execution History)

Tools like SMSView and the SMS Client Center are able to display running executions. I thought that they pull that information from the client, without actually looking at the site database. Am I wrong?



(in reply to mhudson)
Post #: 7
RE: SMS Program History from WMI - 3/26/2009 9:13:26 AM  1 votes
jsandys


Posts: 925
Score: 99
Joined: 3/24/2005
From: San Antonio, TX
Status: offline
Why not look at Roger's code for Client Center, it is an open source tool: http://smsclictr.svn.sourceforge.net/viewvc/smsclictr/SMSCliCtrV2/.

_____________________________

Jason
Configuration Manager MVP
My Blog
Twitter @JasonSandys

(in reply to sserebrennikov)
Post #: 8
RE: SMS Program History from WMI - 3/26/2009 11:18:08 AM   
sserebrennikov

 

Posts: 5
Score: 0
Joined: 3/24/2009
Status: offline
Thank you Jason. I looked at the source code for SMS Client Center.

First of all, SMS Client Center exposes a .NET dll: "smsclictr.automation.dll", using which one could easily view running executions on the sms client.

PS:
[void][System.Reflection.Assembly]::LoadFile("c:\smsclictr.automation.dll")
$SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01", "Domain\SMSAdmin", "password")
$s = $SMSClient.SoftwareDistribution
$s.get_runningexecutions()

And finally, it turns out that running executions can be accessed via WMI on the client as instances of CCM_ExecutionRequest class in root\CCM\SoftMgmtAgent namespace.

PS:
Get-WmiObject -name "root\CCM\SoftMgmtAgent" -query "select * from ccm_executionrequest" -comp hostname

Thank you everybody for your help.


(in reply to sserebrennikov)
Post #: 9
Page:   [1]
All Forums >> [Management Products] >> System Center Products >> System Center Configuration Manager >> SMS Program History from WMI Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.031