Jump to content

How to get env set command output from logged in user on remote workstation


Recommended Posts

Part of my troubleshooting at work sometimes involves grabbing the local environment variables from a remote workstation. I was able to write a quick batch file that displays all environment variables of a remote machine. Unfortunately the environment variable %LOGONSERVER% doesn't show up since that information is logged in workstation user context sensitive.

I'm trying to figure out a way to get the full set command output from another machine (as if I were to go to physically go to another person's workstation, open a command prompt and type in, 'set'; which I have done in the past,

How can I do this using autoit without causing a security issue? I tried to do it via Windows scheduler using interact with Windows Desktop. But my Windows Vista workstations' Schtasks.exe command dont seem to even have an /I switch. Heck I don't even know if that would even work if I did have that switch. :)

Anyway, I'm hoping some clever minds can think of a way to do this the best way possible.

Thanks,

MKANET

Link to comment
Share on other sites

I can assume you are working in a domain environment? If you are doing this remotely, you have to assume they have at least network connectivity and can log in. So the least complicated method I can think of is have create a script that runs on start-up that writes their environmental variables to a file, once or at reasonable intervals. You can than access at your leisure.

Edited by DicatoroftheUSA
Link to comment
Share on other sites

%LOGONSERVER% comes from when a Windows users authenticates against a DC; and, is currently logged in on a machine.

I don't have the ability to add a startup script to our machines enterprise wide. All machines need to keep their current configs.

Link to comment
Share on other sites

psexec could do the job, to run the bat...maybe play with that, since you can specify the user/password to connect as

loop through:

Connect to the station

Copy in the bat

Run psexec on the bat on the station, piped to a dir

grap that piped output

disconnect from station

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

OK, here is a better answer, no the best, the best answer ever... even the answer 42.

#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=Y
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/SOI /SCI /SF

#region - includes
#endregion - includes


AutoItSetOption('TRAYICONDEBUG', TRUE)
AutoItSetOption('MustDeclareVars', TRUE)



_main()
Func _main()
Local $sComputer=InputBox("Question","Enter Target Computer")
If @error Then Exit
_readUsers($sComputer)
EndFunc

Func _readUsers($sComputer)

Local $x=0,$var

While 1
$x+=1
$var = ""&$sComputer&"HKEY_USERS"& RegEnumKey(""&$sComputer&"HKEY_USERS", $x)&'Volatile Environment'
If @error <> 0 then ExitLoop
If Not StringInStr($var,'S-1-5-21') Then ContinueLoop
If StringInStr($var,"_Classes") Then ContinueLoop
_GetVals($var)




WEnd
EndFunc

Func _GetVals($sKeys)
Local $x=0,$var, $sResult
While 1
$x+=1
$var = RegEnumVal($sKeys, $x)
if @error <> 0 Then ExitLoop
$sResult&=@LF&RegRead($sKeys,$var)

WEnd
MsgBox(0,"",$sResult)
EndFunc
Edited by DicatoroftheUSA
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...