HockeyFan Posted June 12, 2007 Share Posted June 12, 2007 (edited) HELP!!! Is there a way with AutoIt to use the Windows Command window but not show the "send" command key sequence sent to it?? I have a script that I am using to change the Computer Name on a "non-domain" Windows XP computer, using the WMIC program, but the problem is sending the key strokes because it displays the Administrators password. Can the Sent key commands be maksed or hidden in any way? I've tried the Run command with the @SW_HIDE, and @SW_MINIMIZED flags, but of course, it doesn't work. Func RenameComputer() $NewName = "TEST" $Admin = "Administrator" $Password = "xxxxxxxx" $WMIC = 'COMPUTERSYSTEM where "Name=' & "'" & @ComputerName & "'" & '"' & " CALL Rename " & $NewName & ", $Password, $Admin" SplashTextOn("", "" & @CR & "Please wait...", 250, 80, -1, -1, 0, "Arial", 14, 400) Run("C:\WINDOWS\system32\wbem\wmic.exe", "C:\WINDOWS\system32\wbem", @SW_SHOW) Sleep(1000) Send($WMIC) Send("{Enter}") Sleep(1000) Send("y") Send("{Enter}") Sleep(1000) Send("exit") Send("{Enter}") Sleep(1000) SplashOff() Shutdown(3) EndFunc Edited June 12, 2007 by HockeyFan Link to comment Share on other sites More sharing options...
/dev/null Posted June 12, 2007 Share Posted June 12, 2007 Run("C:\WINDOWS\system32\wbem\wmic.exe", "C:\WINDOWS\system32\wbem", @SW_SHOW)why do you use wmic.exe? You can use WMI directly with AutoIT. Search the forum for wmi and you will find a lot of samples, including the ones to change the host name. __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
HockeyFan Posted June 12, 2007 Author Share Posted June 12, 2007 why do you use wmic.exe? You can use WMI directly with AutoIT. Search the forum for wmi and you will find a lot of samples, including the ones to change the host name.Thanks...I'll check it out! Link to comment Share on other sites More sharing options...
/dev/null Posted June 12, 2007 Share Posted June 12, 2007 Thanks...I'll check it out!see this post: http://www.autoitscript.com/forum/index.ph...ost&p=82253WARNING: The password is still in the script!! __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
HockeyFan Posted June 12, 2007 Author Share Posted June 12, 2007 see this post: http://www.autoitscript.com/forum/index.ph...ost&p=82253WARNING: The password is still in the script!!Awesome!!! Thanks for that bit of code. It's exactly what I am needing. It's OK that the password is in the script, user's won't be able to decompile the script. 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