Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: WMI listing processes and user as login user not admin local

HTVi
TV Discussion Newsgroups

WMI listing processes and user as login user not admin local
Roland 6/14/2007 8:30:00 AM
the problem is - i will look on a terminal server as a user not as a admin,
who runs as examble the internet explorer. but the script showns me my own
explorer but not the name of the user which opened the internet explorer at
this terminal server.
i see the count of the users but not the names.

see:

strProcess = "iexplore.exe"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process
Where Name = '" & strProcess & "'")

For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
Wscript.Echo "Process " & objProcess.Name & " is owned by " _
& strUserDomain & "\" & strNameOfUser & "."
Next




if i ask a remote terminalserver I have a script wich works fine but no
local.


Const WbemAuthenticationLevelPktPrivacy = 6
strProcess = "iexplore.exe"
strComputer = "192.168.199.199"
strNamespace = "root\cimv2"
strUser = "administrator"
strPassword = "xxxxxxx"

Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, strNamespace, strUser, strPassword)
objWMIService.Security_.authenticationLevel =
WbemAuthenticationLevelPktPrivacy
Set colItems = objWMIService.ExecQuery ("Select * from Win32_Process Where
Name = '" & strProcess & "'")
For Each objItem in ColItems
Return = objItem.GetOwner(strNameOfUser)
colProperties = objitem.GetOwner(strNameOfUser,strUserDomain)
Wscript.Echo strNameOfUser & "."
next


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen