bmy007ro Posted July 23, 2018 Posted July 23, 2018 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 !?
Developers Jos Posted July 23, 2018 Developers Posted July 23, 2018 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Moderators JLogan3o13 Posted July 23, 2018 Moderators Posted July 23, 2018 @bmy007ro look at shellexecute in the help file; it is a pretty straight-forward conversion. As an example, here is one of the PSExec scripts I have used in the past to give you an idea of syntax: $asset = InputBox("RegExport", "Enter the asset tag.") DirCreate('\\' & $asset & '\C$\MyReg') ShellExecute("C:\psexec.exe", '-s \\' & $asset & ' REG EXPORT HKLM\Software\ODBC C:\ODBC.reg', "", "", @SW_HIDE) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
bmy007ro Posted July 23, 2018 Author Posted July 23, 2018 I need it to run on the remote PC that it's the main issue
Moderators JLogan3o13 Posted July 23, 2018 Moderators Posted July 23, 2018 And PSExec has parameters for doing just that, just plug them into your ShellExecute statement. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
bmy007ro Posted July 23, 2018 Author Posted July 23, 2018 I try this but nothing....any idea? Local $sUserName = "aaaaa" Local $sPassword = "bbbbb" Local $sDomain = "yyz" Local $s_Machine = InputBox("Input PC name", "Enter Computer Name") ShellExecute("c:\Temp\TT\PsExec.exe", '-s \\' & $s_Machine & ' -u' & $sUserName & ' -p' & $sPassword & ' \\NET\Files\FILENAME.cmd > C:\Temp\TT\My.log', "", "", @SW_HIDE)
Skeletor Posted July 24, 2018 Posted July 24, 2018 I would rather suggest using the command prompt then executing the exe. As far as I have tested you cant run PsExec straight as it is a command line program. NOTE: When posting code, make sure you click on the <> and paste your code in. Local $sUserName = "aaaaa" Local $sPassword = "bbbbb" Local $sDomain = "yyz" Local $s_Machine = InputBox("Input PC name", "Enter Computer Name") Run(@ComSpec & " /k " & 'c:\Temp\TT\PsExec.exe -s \\ ' & $s_Machine & ' -u '& $sUserName & '-p ' & $sPassword & ' \\NET\File\FILENAME.bat > C:\Temp\data.log', "", @SW_SHOW) Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
Moderators JLogan3o13 Posted July 24, 2018 Moderators Posted July 24, 2018 5 hours ago, Skeletor said: As far as I have tested you cant run PsExec straight as it is a command line program. That is untrue, as I do so often both in AutoIt and PowerShell "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Skeletor Posted July 29, 2018 Posted July 29, 2018 @JLogan3o13, Please submit the code you used. Thanks! Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
spudw2k Posted July 31, 2018 Posted July 31, 2018 You should be able to call psexec.exe directly using Run or ShellExecute. The tricky parts may be if you want to automate StdIn or StdOut. There are functions for those too. Check out the examples in the help file. StdinWrite() StdoutRead() 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 Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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