simusphere Posted February 12, 2008 Share Posted February 12, 2008 I thought this would be easy for me but something is eluding me. The following code is a very basic GUI to push out a local administrator password change to all machines on the network (assuming the current admin passwords are the same). I can easily do this on the command line, which is what I have been doing but can't seem to get this run and show the command shell with all of the output to the command. There are some consolewrites in there since I am still trouble shooting this. This is mostly for windows 2k windows xp workstations but I would like to get it to work with vista too. Any ideas? Also just using this command on the command line won't work with some passwords like ones that include "&" symbol for some reason. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.11.0 (beta) Author: Simusphere Script Function: Resets all local admin passwords for windows machines in C:\temp\list.txt Pstools executables must be in your executable path for this to work. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Global $reset_local_admin = GUICreate("Reset Local Admin Password", 316, 230, 419, 383) GUISetIcon("D:\003.ico") Global $DMT_Net_Grp = GUICtrlCreateGroup("Push New Password Out To All Windows Machines", 8, 1, 297, 161) Global $OldPwInput = GUICtrlCreateInput("", 24, 32, 121, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) Global $NewPwInput1 = GUICtrlCreateInput("", 24, 84, 121, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) Global $CurrentPwLabel = GUICtrlCreateLabel("Enter Current Password", 160, 36, 115, 17) Global $NewPwInput2 = GUICtrlCreateInput("", 24, 120, 121, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) Global $NewPwLabel = GUICtrlCreateLabel("Enter New Password", 160, 88, 103, 17) Global $ReEnterPwLabel = GUICtrlCreateLabel("Re-Enter New Password", 160, 124, 120, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $OK = GUICtrlCreateButton("&OK", 65, 179, 75, 25, 0) Global $Cancel = GUICtrlCreateButton("&Cancel", 162, 179, 75, 25, 0) Global $ParamS, $PW1, $PW2 GUISetState(@SW_SHOW) #EndRegion ### START Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Cancel Exit Case $OK $PW1 = GUICtrlRead($NewPwInput1) $PW2 = GUICtrlRead($NewPwInput2) $OldPw = GUICtrlRead($OldPwInput) ; Next three lines were for trouble shooting actual passwords entered ConsoleWrite("OldPw=" & $OldPw & @LF) ConsoleWrite("PW1=" & $PW1 & @LF) ConsoleWrite("PW2=" & $PW2 & @LF) $ParamS = "@C:\temp\list.txt -u administrator " & $OldPw & " administrator " & $PW1 If $PW1 == $PW2 Then ConsoleWrite("ParamS=" & $ParamS & @LF) $x = ShellExecute("pspasswd", $ParamS, "", "open", @SW_HIDE) ConsoleWrite("x=" & $x & @LF) Sleep(2000) Exit Else MsgBox(0, "ERROR!", "Passwords do not Match") ContinueLoop EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
simusphere Posted February 13, 2008 Author Share Posted February 13, 2008 Anybody? I did find some others that have coded full front ends for pstools but I just wanted to do this one simple task and have the output go to a regular command line window so the formating of the output looks normal. All of the other fronends I have found don't format the output correctly and that's not what I'm after. I would also like to figure out how to get no standard symbols to work in the passwords like "&". Link to comment Share on other sites More sharing options...
Swift Posted February 13, 2008 Share Posted February 13, 2008 Vista's Stupid It Does'nt Work. Well..Your tring to change the password of a network admin(s)? I dont know how to do this. Nor do I have a network to test it on If you show me the programs stuff I need to change the password...so I can see what they execute. I might be able to help you Link to comment Share on other sites More sharing options...
simusphere Posted February 13, 2008 Author Share Posted February 13, 2008 WTFO I am trying to make a super simple frontend GUI for the pstools utility command "pspasswd". If you have your own computer, you can test it out on your own machine only. I am a network admin so I need to use it for an entire network. All of the pstools utilities are great by themselves but even better in an autoit GUI. So far I've been forced to use pspassword directly from the command line because my current autoit method doesn't work yet. Any constructive ideas on getting this to work? 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