|
|
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
|
|
|