Jump to content

Puck

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Puck

  1. I tried to put the file there first but still same issue. If I remove the flags for $STDERR_MERGED everythign works fine in the child window. I am sure I am missing something simple just cant pinpoint it.
  2. Ok, tried that with same results. If I use psexec parameter '-i' it completes but only StdErr. If I dont use '-i' it just hangs.
  3. Getting closer. I added the -i parameter and now I get StdErr but no StdOut. here is my exact command. I am forcing a copy of the bat file to the server. #include <Constants.au3> $foo = Run("psexec -i \\myserver.somewhere.net -c -f ip.bat", @ScriptDir, @SW_HIDE, $STDERR_MERGED) While 1 $line = StdoutRead($foo) If @error Then ExitLoop ConsoleWrite($line) WEnd While 1 $line = StderrRead($foo) If @error Then ExitLoop ConsoleWrite($line) WEnd
  4. I am trying to grab the output from a batch file run by psexec on a remote computer. This works #include <Constants.au3> $foo = Run("psexec \\servername ipconfig", @ScriptDir, @SW_HIDE, $STDERR_MERGED) While 1 $line = StdoutRead($foo) If @error Then ExitLoop ConsoleWrite($line) WEnd While 1 $line = StderrRead($foo) If @error Then ExitLoop ConsoleWrite($line) WEnd But if i create a batch file with 'ipconfig' in it if hangs. Is it possible to grab the output of psexec if it runs a batch file? Any input would be appreciated.
  5. Sorry to reply to my own post but it looks like I needed GUIRegisterMsg. #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> GUICreate("Preview Test") $hInput1 = GUICtrlCreateInput("", 20, 20, 100, 21) $hInput2 = GUICtrlCreateInput("", 200, 20, 100, 21) $preview = GUICtrlCreateLabel("", 20, 100, 268, 33) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MY_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $text1 , $text2 Local $iIDFrom = BitAND($wParam, 0xFFFF) Local $iCode = BitShift($wParam, 16) If $iCode = $EN_CHANGE Then $text1 = GUICtrlRead($hInput1, 1) $text2 = GUICtrlRead($hInput2, 1) GUICtrlSetData($preview, $text1 & " " & $text2 ) EndIf EndFunc
  6. Hello all. I am trying to simulatate what is beening done in this .HTA script here. http://community.spiceworks.com/scripts/show/673-psexec-command-builder-hta In that I want a preview pane that will autoupdate as the users changes options on the main form, specifically with the 'command' and 'variables' input fields. The lower pane autoupdates as the user is typing. I trying to search a bit but I may not be using the correct search term to do what I want. Any push in the right direction would be appreciated. dtp
  7. I have been asked to create a pretty simple idiot proof backup utility for users to take a snapshot of specific directories. I am using Truecrypt on USB drive for encryption. Right now I have the script hard coded to use T: for the encrypted container but would really like some way of letting Truecrypt use 'first available' in the very rare event T: is being used for something else. Here is what I have so far. Any tips on how to accomplish this would be greatly appreciated. Thanks ;USB Backup #include <GuiConstantsEx.au3> #include <GuiEdit.au3> ;Check if first time run and if so force password change $FirstCheck = FileExists(@ScriptDir & "\firstrun") If $FirstCheck = 1 Then Call("PasswordChange") ; Create Backup GUI $Backup = GuiCreate("Backup Utility", 230, 120) GuiSetIcon(@ScriptDir&"\Truecrypt\nw.ico") ; Create Backup GUI BUTTONS $Button_Backup = GuiCtrlCreateButton("Backup", 10, 10, 100, 100) $Button_Restore = GUICtrlCreateButton("Restore", 120, 10, 100, 100) ;$Button_Exit = GUICtrlCreateButton("Exit", 65, 120, 100, 100) ; Show GUI GuiSetState(@SW_SHOW,$Backup) ;Unmap T Drive DriveMapDel("T:") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_Backup GuiSetState(@SW_HIDE,$Backup) Run(@ScriptDir&"\TrueCrypt\TrueCrypt.exe /q background /lt /m rm /v nwbackup.tc") WinWaitActive("Enter password") WinWaitClose("Enter password") Do $DrvStatus = DriveStatus("T:") Sleep(1000) Until $DrvStatus = "READY" SplashTextOn("NW Backup", @CRLF&"Backing up My Documents", 300, 75) RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe "'&@MyDocumentsDir&'" t:\backups\mydocs\ *.* /MIR') SplashTextOn("NW Backup", @CRLF&"Backing up Desktop", 300, 75) RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe "'&@DesktopDir&'" t:\backups\desktop\ *.* /MIR') SplashTextOn("NW Backup", @CRLF&"Backing up Favorites", 300, 75) RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe "'&@FavoritesDir&'" t:\backups\favorites\ *.* /MIR') SplashTextOn("NW Backup", @CRLF&"Backing up Misc.", 300, 75) RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe "'&@ProgramFilesDir&'\LOTUS\NOTES\DATA\" t:\backups\lnotes\ names.nsf /MIR') RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe "'&@ProgramFilesDir&'\NWDESKTOP\" t:\backups\NWDESKTOP\ *.* /MIR') RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe "'&@ProgramFilesDir&'\NWDESKTOP_BACKUP\" t:\backups\NWDESKTOP_BACKUP\ *.* /MIR') SplashOff() MsgBox(0,"NW Backup","Backup Complete") Run(@ScriptDir&"\TrueCrypt\TrueCrypt.exe /q /dt") SplashTextOn("NW Backup",@CRLF&"Please wait while the encrypted container is dismounted.",425,75) Do $DrvStatus = DriveStatus("T:") Sleep(1000) Until $DrvStatus = "Invalid" SplashOff() MsgBox(0,"NW Backup","It is now safe to remove your drive") Exit Case $msg = $Button_Restore GuiSetState(@SW_HIDE,$Backup) Run(@ScriptDir&"\TrueCrypt\TrueCrypt.exe /q background /lt /m rm /v nwbackup.tc") WinWaitActive("Enter password") WinWaitClose("Enter password") Do $DrvStatus = DriveStatus("T:") Sleep(1000) Until $DrvStatus = "READY" SplashTextOn("NW Backup", @CRLF&"Restoring My Documents", 300, 75) RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe t:\backups\mydocs\ "'&@MyDocumentsDir&'" *.* /E') SplashTextOn("NW Backup", @CRLF&"Restoring Desktop", 300, 75) RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe t:\backups\desktop\ "'&@DesktopDir&'" *.* /E') SplashTextOn("NW Backup", @CRLF&"Restoring Favorites", 300, 75) RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe t:\backups\favorites\ "'&@FavoritesDir&'" *.* /E') SplashTextOn("NW Backup", @CRLF&"Restoring Misc.") RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe t:\backups\lnotes\ "'&@ProgramFilesDir&'\LOTUS\NOTES\DATA\" names.nsf /E') RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe t:\backups\NWDESKTOP\ "'&@ProgramFilesDir&'\NWDESKTOP\" *.* /E') RunWait(@COMSPEC & ' /c '&@ScriptDir&'robocopy.exe t:\backups\NWDESKTOP_BACKUP\ "'&@ProgramFilesDir&'\NWDESKTOP_BACKUP\" *.* /E') SplashOff() MsgBox(0,"NW Backup","Restore Complete") Run(@ScriptDir&"\TrueCrypt\TrueCrypt.exe /q /dt") SplashTextOn("NW Backup",@CRLF&"Please wait while the encrypted container is dismounted.",300,75) Do $DrvStatus = DriveStatus("T:") Sleep(1000) Until $DrvStatus = "Invalid" SplashOff() MsgBox(0,"NW Backup","It is now safe to remove your drive") Exit EndSelect WEnd Func PasswordChange() $i = 1 MsgBox(0, "Password Change", "This appears to be your first time using this utility. You must now select a password") $CHPW = GUICreate("Password Change",300,200) GuiCtrlCreateLabel("Please select a new password and confirm"&@CRLF&@CRLF&"Password needs to be at least 8 characters in length", 10, 10, 280, 50) $INPUT_1 = GUICtrlCreateInput("New Password",5,100,290,20,$ES_PASSWORD) $INPUT_2 = GUICtrlCreateInput("Confirm Password",5,125,290,20,$ES_PASSWORD) $Button_OK = GUICtrlCreateButton("OK", 130, 152, 40, 40) GUISetState(@SW_SHOW,$CHPW) While $i = 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_OK $NEWPW = GUICtrlRead($INPUT_1) $CONFIRMPW = GUICtrlRead($INPUT_2) If StringLen($NEWPW) <= 7 Then MsgBox(0, "Pasword Length", "Password is to short. Password needs to be at least 8 characters in length.") ElseIf StringCompare($NEWPW, $CONFIRMPW) <> 0 Then MsgBox(0, "Password Mismatch", "Passwords do not match!") Else $i = 0 EndIf EndSelect Wend MsgBox(0,"NOTICE!","Password change can take up to 2 minutes. Please do not touch the keyboard or mouse."&@CRLF&@CRLF&"Click OK to begin.") GUISetState(@SW_HIDE,$CHPW) SplashTextOn("NW Backup","Changing Password...Please Wait",300,75) Run(@ScriptDir & "\Truecrypt\Truecrypt.exe") WinWaitActive("TrueCrypt") Send("!F") WinWaitActive("Select a TrueCrypt Volume") Send(@Scriptdir&"nwbackup.tc{ENTER}") Send("{ALT}vcc{ENTER}") WinWaitActive("Change Password or Keyfiles") Send("nwdefault{TAB}{TAB}{TAB}"&$NEWPW&"{TAB}"&$CONFIRMPW&"{TAB}{ENTER}") WinWaitActive("TrueCrypt","WARNING") Send("!Y") WinWaitActive("TrueCrypt","Password") Send("{ENTER}") WinWaitActive("TrueCrypt","&Create Volume") Send("!X") SplashOff() MsgBox(0,"Password change","Password change complete."&@CRLF&@CRLF&"Click OK to return.") FileDelete(@ScriptDir & "\firstrun") EndFunc
  8. I have an older 'compiled' Autoit 2 script that I want to update to V3 but sadly I cant remember passphrase. It is a simple script that launched TeraTerm to to configure a JetDirect card's IP Address. I would prefer not to have to rewrite it. I will attach it here and hopefully someone can put it back into script form. Thanks JetDirect.exe
×
×
  • Create New...