Search the Community
Showing results for tags 'psexec'.
-
Hi everyone, Hope you are doing fine by the time being :/ Well, seems that I'm running into an issue while trying to add an Active domain security group to a remote computer that has a space in it. I've been searching for quite a while now and seems that my search did not get well. The ideal solution for me would be to use Psexec.exe as I can run it with my admin credentials whereas using WMIServices, I don't know how to launch that with these credentials. Here's what I wrote so far: $sADGroupName as a space in it and there's nothing I can do about, we have to respect a naming convention but it would be "Admins REMOTEMACHINENAME" Func f_AddADGroup2localAdmin() SplashTextOn("", "Adding " & $sADGroupName & " to the Local Administrators Group.", 1000, 100, -1, -1, 33, -1, -1, 700) $sCommand = $sResources & 'PsExec -accepteula \\' & $sServName & ' net localgroup Administrators MYDOMAIN\"' & $sADGroupName & '" /add' RunAsWait($sTechGID, "MYDOMAIN", $sTechPWD, 4, $sCommand, @SW_SHOW) SplashOff() ; f_MoveADObject() End Func What is weird is when I output the $sCommand variable, the space is in here but it seems not to be passed in my psexec command when I run it. Another thing I saw is that 4 times out of 10, psexec does not even launch. So I was also wondering if there could be another way to add the "spaced" group with my admin credentials on a remote server other than psexec. Thanks all in advance for the lights you may provide to me and keep safe! -31290-
-
I have this psexec command working fine Local $sMachine = InputBox("Input PC name", "Enter Computer Name") psexec \\$sMachine -u $sDomain\$sUserName -p $sPassword \\NetworkFLD\FILENAME.cmd > C:\Temp\TT\My.log I wanted to converted to AutoIT script Cloud you help, please !?
-
I'm attempting to capture the output from the command line tool PSEXEC. I'm using AutoIT to run an instance of PSEXEC against a remote PC to audit Local Admins in my environment using net.exe (C:\Windows\System32> net localgroup administrators). However the usual trick I use to capture command line output does not appear to work well with PSEXEC, as the bottom portion of the output is missing from the return. Any ideas or recommendations are greatly appreciated. Here is what I'm working with: ;This script will read from a list of hosts and report who has local admin privileges on the machine #RequireAdmin Global $fileName = @ScriptDir & '\test.txt' ;hostlist, one host per line readHostList() ;Read list of hosts Func readHostList() Local $file = FileOpen($fileName, 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ConsoleWrite($line & @CRLF) ;MsgBox(0,0,$line) getLocalAdmins($line) WEnd FileClose($file) EndFunc ;run PSEXEC to list local admins Func getLocalAdmins($remotePC) Local $testFile = @ScriptDir &'\test234.txt' FileOpen($testFile, 1) Local $psexec = 'psexec \\' & $remotePC & ' net localgroup administrators' FileWriteLine($testFile, _RunCmd($psexec) ) FileClose($testFile) EndFunc ;Used to return CLI output Func _RunCmd($sCommand) Local $nPid = Run(@Comspec & " /c" & $sCommand, @SystemDir, @SW_Hide, 8), $sRet = "" If @Error then Return "ERROR:" & @ERROR ProcessWait($nPid) While 1 $sRet &= StdoutRead($nPID) If @error Or (Not ProcessExists ($nPid)) Then ExitLoop WEnd Return $sRet EndFunc ## If i manually run the command on the remote PC via PSEXEC I will get the following output: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com Starting net on PCNAME... on PCNAME... net exited on PCNAME with error code 0. ------------------------------------------------------------------------------- admin Administrator Alias name administrators Domain\Domain Admins Comment Administrators have complete and unrestricted access to the computer/domain Members The command completed successfully. ## The returned output from running the above script is as follows: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com Alias name administrators Connecting to PCNAME... Starting PSEXESVC service on PCNAME... Connecting with PsExec service on PCName... Starting net on PCNAME.. net exited on PCNAME with error code 0. **Note to test this script PSEXEC must be in the system dir or the path in the script changed PSEXEC tool: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
-
I am trying to spawn a cmd.exe shell on a remote machine using psexec then proceed to running commands on that machine and reading the output. I.e. running pwd. Unfortunately, the code I have now will just immediately exit cmd on the remote system I'm trying to use the current code #include <Constants.au3> $pid = Run('C:\Users\test\Desktop\psexec.exe \\192.168.1.123 -u test -p "P@$$word1" -h -s cmd',@SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($pid,"pwd") StdinWrite($pid,@CRLF) Local $data Sleep(2000) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) StdinWrite($pid,"cd ") StdinWrite($pid,"C:\users\test2") StdinWrite($pid,@CRLF) StdinWrite($pid) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) http://stackoverflow.com/questions/19206834/command-prompt-and-autoit-stdinwrite <- credits to this stack overflow post Unfortunately, on my end, my cmd just starts/stops with this prompt Connecting with PsExec service on 192.1.123...Starting cmd on 192.168.1.123... cmd exited on 192.168.1.123 with error code 0. Any ideas how I can keep my shell open over psexec and still interact with it using AutoIT? Any feed back would be amazing! Thanks!
-
I have enabled admin sharing in the remote machine so that I can copy files to the remote machine use PSEXEC to execute our application remotely. Now, if the machine is poweredoff we need to poweriton. So I checked whether the remote machine, it is of both VirtualBox or VMWare one. For VirtualBox or VMware, I have found command line utities to poweron. But to autologon by skipping the login screen.Can anyone suggest how to do the same.If it is a physical machine, then there is no need to poweron but autologon is required. I am trying for windows machines.Win 7 at present. For VirtualBox I checked below link with help og guestadditions but not working. http://www.virtualbox.org/manual/ch09.html#autologon The below procedure will save the password in that machine and it will logon automatically. http://www.howtogeek.com/112919/how-to-make-your-windows-8-computer-logon-automatically/ But it will give access to everyne.But my opinion is he should access only if have credentias.I mean through any commandline from another machine he should trigger logon also by passing credentials. Similarly this also http://www.cnet.com/how-to/automatically-log-in-to-your-windows-10-pc/ http://superuser.com/questions/28647/how-do-i-enable-automatic-logon-in-windows-7-when-im-on-a-domain http://pcsupport.about.com/od/windows7/ht/auto-logon-windows-7.htm http://www.computerperformance.co.uk/windows7/windows7_auto_logon.htm https://technet.microsoft.com/en-us/magazine/ee872306.aspx Please guide me how to proceed.
-
When I run a program in remote vm virtualbix machine windows 7 64 bit with psexec from my current machine. It is working fine in system context. C:\Users\kirud01>"C:\Software\application packaging\PsTools\PsExec.exe" -s -i -d "\\erwin-pc" -c -f "C:\Build\delete.exe" But when I run the same in user context i.e., without -s parameter. The screen is getting freezed in the remote machine. Could you please help me on this. If possible any alternatives for PSEXEC in AutoIT code itself.
- 2 replies
-
- psexec
- remote execution
-
(and 2 more)
Tagged with:
-
Can anyone tell me why this won't run? I know I have to be close to makeing it work. $ipAddress = InputBox("IP or Host", "Enter IP or Hostname","","") $sRemoteLocalPath = "c:\temp\" $LocalFile = "uninstall_java.bat" Run('PsExec \\' & $ipAddress & ' "' & $sRemoteLocalPath & $LocalFile & '"', '', @SW_HIDE)
-
From within an AutoIt Script, I'm trying to use psexec with system authority to copy files from one place on a remote machine to another. When I issue the necessary command outside of the script (at a command prompt), the command executes properly. Here's the exact one-line command: psexec \\vmhartlti01 -s XCOPY "C:\temp\hs\Hyperspace POC.lnk" "C:\Documents and Settings\All Users\Application Data\Landesk\ManagementSuite\Launchpad\Dept Apps\" /Y When I try to run the exact same command from within an AutoIt Script, an XCOPY parse error 4 flashes up for a millisecond in the console and the command fails. The command appears to be formed properly in the message box popup. $cmd = 'psexec \\vmhartlti01 -s XCOPY "C:\temp\hs\Hyperspace POC.lnk" "C:\Documents and Settings\All Users\Application Data\Landesk\ManagementSuite\Launchpad\Dept Apps\" /Y' MsgBox(4096, "test", $cmd) $XCopyStatus = Run($cmd, "c:\temp") The Run command returns the XCOPY PID rather than zero, further obfuscating the problem. I've been working on this for a while now and I think I must be missing something. Does anyone see the problem? Thanks for your help.
-
Good Morning, I want to take this: Run("cmd.exe") Sleep(1000) Send("cd /{Enter}") Sleep(1000) Send("cd pstools{Enter}") Sleep(1000) Send("psexec \\192.168.26.17\ cmd.exe{Enter}") Sleep(5000) Send("cd /{Enter}") Sleep(2000) Send("cd Program Files\WebHelpDesk{Enter}") Sleep(2000) Send("whd_stop.bat{Enter}") and make it into something like this Run("c:\psexec \\192.168.26.17 -s c:\program files\webhelpdesk\whd_stop.bat") However when I run the second one, I get an error that states that PSEXEC is already running on the remote PC. It would appear that it is trying to run the script however something in the translatation is causing PSEXEC on the remote PC to hang. Any ideas on what is wrong with the script? I goal here is to execute the remote batch file but have the cmd window open and showing the results on my local PC. Thanks, Grimm