Stucky Posted August 29, 2008 Share Posted August 29, 2008 Having the computername of a remote computer I would like to retreive the username that is logged on that machine. Link to comment Share on other sites More sharing options...
Andreik Posted August 29, 2008 Share Posted August 29, 2008 Having the computername of a remote computer I would like to retreive the username that is logged on that machine.@UserName When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Stucky Posted August 29, 2008 Author Share Posted August 29, 2008 Having the computername of a remote computer I would like to retreive the username that is logged on that machine.Found it:$sUserName = RegRead('\\' & $strComputername" & '\' & 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\WinLogon', 'DefaultUserName') Link to comment Share on other sites More sharing options...
spudw2k Posted August 29, 2008 Share Posted August 29, 2008 That registry key is the last user login. It doesn't necessarily mean that the machine is logged into. Use this to determin the user logged into the Console session. (I say console because this method doesn't return terminal sessions) $strHost = "." $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strHost & "\root\cimv2") $colItems = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem") For $objItem In $colItems $strCurrentUser = $objItem.UserName Next msgbox(0,"Logged On User",$strCurrentUser) Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
gcue Posted September 15, 2008 Share Posted September 15, 2008 I got this to work only if I was the user logged on to the remote system =/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now