Collection username from workstations using custom rule/wmi
HiI have been tasked with gathering the username of the currently logged on user on workstations, however i can not figure out how to do this using custom rules and wmi.What i need to do is create a report contaning Username, PC manufacture, PC model and PC serial number for all workstations in the domain. Currently i have tried creating a custom attribute, and a wmi event based collection rule i could nog get those to work.Is this at all possible?,i have seen the post about creating a custom task for, but i would like to automate this, and somehow attach the information to the workstation objects.
June 3rd, 2009 11:20am

You could certainly do this with WMI and VBScript. You could use this in a script-based object discovery targeted at the appropriate Windows OS class or through an agent task. There is a script to retrieve this info athttp://msdn.microsoft.com/en-us/library/aa394586(VS.85).aspx strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colComputer = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") For Each objComputer in colComputer Wscript.Echo "User Name = " & objComputer.UserName _ & VBNewLine & "Computer Name = " & objComputer.Name WScript.Echo objComputer.UserName Next Pete Zerger, MVP-MOM | http://www.systemcenterforum.org
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2009 9:31am

Hi PeterThanks for taking the time to answer :-)I ama little confusedabout what you mean, as far as i can see, i can only use object discoveries (Administration pane > discovery wizard)to discover objects to manage or am i missing something?Yes i do know about the agent task but we would really like to automate this for all the workstations (you know work smarter, not harder... yes we are lazy :-)Currently i am revisiting the WMI event based collection rule, to see if i can get this to work with a revised WMI query.
June 4th, 2009 1:42pm

Hello Michael,It is not a built-in function in SCEto retrieve thecurrently logged on user on the managed computers. To do it, youshould create a console task in the Authoring Pane by selecting New Task > Console Tasks > Command line.You can find the details in the thread below:Possible Solution: Display Last Logged On Userhttp://social.technet.microsoft.com/Forums/en-US/systemcenter/thread/4d1a9603-be45-412e-ba2d-8c057cdca820/Hope it helps,Yog Li - MSFT
Free Windows Admin Tool Kit Click here and download it now
June 5th, 2009 1:36pm

this might not answer your question in regards to using wmi, but it may prove as a solution to your problem. pstools suite http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx the pstools suite has some great utilities, one of which is "psLoggedOn" which will tell you console logons as well as users accessing shares. and you can query a whole domain with "psloggedon \\*" (assuming domian level privs) and there's other tools in the suite for extracting the other info you need. put them together in a batch script and you should get what you need.
June 18th, 2009 8:09pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics