Hi,
i found a vb script which works fine and gives me desired output however i am looking to get this converted to powershell, so that i can add this to an existing shell script
Purpose : the shell script should display/Echo currently logged on user, by reading the wmi
Below is the vb script which i found, also i dont want its first line because i will be running the script locally on the computer with admin rights
--------
strComputer = "atl-ws-01" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = 'explorer.exe'") If colItems.Count = 0 Then Wscript.Echo "No one is logged on to the computer." Else For Each objProcess in colItems objProcess.GetOwner strUser, strDomain Wscript.Echo strDomain & "\" & strUser Next End If
--------
Regards
Tanoj