-
Posts
44 -
Joined
-
Last visited
Everything posted by Tumulus
-
Yeah. Great idea there. Thanks!
-
That makes sense. I could possibly take the #require admin off... SCCM is the goal, though if we have compliance issues (our SCCM isn't as reliable as we would like) then GPO is an option.
-
I turned off SCEP and firewall but the error still persisted. However, I took the file from off of my personal network drive and copied it to the desktop. It runs just fine from there. Would there be an issue with permissions when accessing the script from my drive or something? I've never had issues before, although I am using a different machine today than the one I usually use.
-
Possibly the AV. I can check SCEP, though I don't think we have updated since yesterday when the script was working. I'll poke around and let you know.
-
That is actually a good point. Also, scary article. Glad I don't use Teamviewer for personal stuff. I'll be sure to forward that around. Appears that our passwords really could use an update. What could I use in place of the pid? Could I put "TeamViewer" in place of it? Also, I ran into an issue using Run and couldn't quite figure it out, so did this as a work around. I'll give run another look.
-
I have a code that will open an application we use for remote connections here at work and then change the password for it. We were audited recently and told our security was a bit lax, so we are overhauling our password convention and changing our current passwords. This script was working until just this morning and then started to give an error right at the cusp of QA testing. It says "Line 0 ("M:\Scripts\AutoIT\TVPasswordChange.au3"): Error: Error opening the file" I haven't seen this before, and I don't think we made any significant changes to our code (I added the two control sends to delete the contents of the password field) that could have caused it. Any ideas why it might be failing to open? #RequireAdmin Global $SingleClick = 1 If ProcessExists(13696) Then MsgBox(0, "", "TeamViewer process already exists. Closing process.") ProcessClose(13696) ProcessWaitClose(13696) EndIf Run("cmd") WinWaitActive("Administrator") Send("cd C:\Program Files (x86)\TeamViewer\Version8\") Send("{Enter}") Send("TeamViewer.exe") Send("{ENTER}") WinWaitActive("TeamViewer") Sleep (1000) $pos = WinGetPos("[ACTIVE]") $x = 115 $y = 40 MouseClick("left", $pos[0] + $x, $pos[1] + $y) ;clicks "Extras" Sleep (500) MouseClick("left", $pos[0] + $x + 15, $pos[1] + $y + 25) ;clicks "Options" Sleep (500) WinWaitActive("TeamViewer options") ControlClick("TeamViewer options", "TvOptionList", 20586, "left", $SingleClick, 32, 48) ;clicks "Security" Sleep (500) ControlSend("TeamViewer options", "", 20065, "^a{BS}");deletes the password field Sleep (500) ControlSend("TeamViewer options", "", 20065, "password");types in "Password" field Sleep (500) ControlSend("TeamViewer options", "", 20066, "^a{BS}");deletes the confirm password field Sleep (500) ControlSend("TeamViewer options", "", 20066, "password");types in "Confirm Password" field Sleep (500) ControlClick("TeamViewer options", "O&K", 1, "left", $SingleClick, 40, 10);clicks "OK" MsgBox(0, "SUCCESS", "The Teamviewer password has been succesfully changed") WinClose("TeamViewer") WinClose("Administrator")
-
Got ya. Well thanks!
-
Interesting. That totally fixed the problem and made the script run correctly... Why would that be? Does #requireadmin need to run in an administrative SciTE? I don't remember needing it before.
-
Still seeing nothing in the console. The array display does appear however... #RequireAdmin #include<LocalAccount.au3> #include<Array.au3> Global $aNames = '' $aNames = _GroupEnumMembers('Administrators') _ArrayDisplay($aNames) ConsoleWrite(@CRLF & 'The bound is: ' & UBound($aNames) & @CRLF) For $i = 1 to UBound($aNames) - 1 If $aNames[$i] <> '(desired name)' Then ConsoleWrite(@CRLF & 'Account Deleted: ' & $aNames[$i] & @CRLF) _AccountDelete($aNames[$i]) EndIf Next Any idea why?
-
Yes. We are trying to get rid of all admin accounts other than a desired account. We have a lot of computers that have different accounts or multiple accounts, so we are setting a default account on all computers and then running this script. Hmm... that would write exactly what I want to the console, but the odd thing is that nothing is being written there from either ConsoleWrite. Do you have any idea why? Did I perhaps change a setting by accident? This is what my console shows after running the script: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "M:\Work Docs\Scripts\AutoIT\ChangeLocalAdmin\DeleteLocalAdminTest.au3" /UserParams +>15:47:21 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00000409 OS:WIN_81/ CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper >Running AU3Check (3.3.12.0) from:C:\Program Files (x86)\AutoIt3 input:M:\Work Docs\Scripts\AutoIT\ChangeLocalAdmin\DeleteLocalAdminTest.au3 +>15:47:21 AU3Check ended.rc:0 >Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "M:\Work Docs\Scripts\AutoIT\ChangeLocalAdmin\DeleteLocalAdminTest.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop +>15:47:21 AutoIt3.exe ended.rc:0 +>15:47:21 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.4974
-
Alright, I looked over the code and made a few changes based on all these suggestions. Looks like I was not quite correct in a number of places. Here is what I've got. I included #require admin (oops), used _GroupEnumMembers, checked the Ubound, and moved the Next. #RequireAdmin #include<LocalAccount.au3> #include<Array.au3> Global $aNames = '' $aNames = _GroupEnumMembers('Administrators') _ArrayDisplay($aNames) ConsoleWrite(UBound($aNames)) For $i = 1 to UBound($aNames) - 1 If $aNames[$i] <> "(desired name)" Then _AccountDelete($aNames[$i]) EndIf Next Still doesn't delete what I want, and oddly enough, I am not seeing my console write anymore...
-
@AdamUL Thanks for the info there! That has got to be my problem. I wondered where the 4 account was coming from... I should have looked into it more. I'll fix that and see if that works.
-
I fixed both the Next positioning and checked the Ubound. It gives the correct number I need. I don't get the If syntax error anymore with the next fixed, but I am still not getting the accounts to actually delete. I've used this command in the UDF before, so it has to be something else.
-
I have a script to delete unwanted admin accounts from our computers. I put the names into an array and then compare each member to a specific user name. If they don't match, I intend to delete them, but when my script enters the if statement I encounter an error. "M:\Work Docs\Scripts\AutoIT\ChangeLocalAdmin\DeleteLocalAdminTest.au3" (13) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $aNames[$i] <> "(desired account name)" Then If ^ ERROR It then exits with code 1. #include<LocalAccount.au3> #include<Array.au3> Global $aNames = '' Global $Output = '' $aNames = _AccountEnum() _ArrayDisplay($aNames) For $i = 0 to UBound($aNames) - 1 Next If $aNames[$i] <> "(desired name)" Then _AccountDelete($aNames[$i]) EndIf What is my mistake here?
-
Yeah, I agree. However, our supervisor wants a script solution. Why he does is beyond me.
-
Awesome. That worked! I used AdamUL's code in the comment above. Yeah, we have a default account named "administrator" on a lot of computers and then some random admin accounts on others, which isn't very secure, so we are deploying a script to all our machines to change the default admin name and password to a new secure account. Thanks Guys!
-
Thanks! That worked perfectly. Is there a way that I could have the local admin account name automatically populate instead of prompting the user for it?
-
That should work fine, but you could try to simplify it and take out a few lines. IsArray returns 1 if the check is succesful or a 0 if not. So you could use that bool condition in your If statement instead of the whole function. Not too much different, but it would get rid of the need for an else statement. $bCheck = IsArray($box) If $bCheck = 0 Then SoundPlay(@WindowsDir & '\media\tada.wav', 1)
-
We changed security procedures and are changing the name of the local admin account on a computer. I created a script that changes the account, but only if the account is named "administrator". I need to change it to work with any administrator account name. Here is what I tried: #RequireAdmin #include<LocalAccount.au3> Global $OKMSGBOX = 1 $strComputer = "." ;This and the following two lines are newly added $CPU = ObjGet("WinNT://" & $strComputer & ",Computer") Local $sAdminAcct = $CPU.GetObject("User", "Administrator") Local $sUsername = InputBox('Password', 'New Admin Username: ', '', '*', -1, -1, 0, 0, 10000) MsgBox($OKMSGBOX, '', $sAdminAcct) ;for testing. Diplays a blank msgbox $boolrun = 1 While ($boolrun) $sPassword1 = InputBox('Password', 'New Admin Password: ', '', '*', -1, -1, 0, 0, 10000) $sPassword2 = InputBox('Password', 'Re-Enter New Admin Password: ', '', '*', -1, -1, 0, 0, 10000) If $sPassword1 == $sPassword2 Then _AccountSetPassword($sAdminAcct, $sPassword1, '0') _AccountRename($sAdminAcct, $sUsername, @ComputerName) $boolrun = 0 Else MsgBox($OKMSGBOX, '', 'The passwords you entered do not match.' & @CRLF _ & 'Please re-enter the desired admin credentials.') EndIf WEnd I added a few lines to assign the local admin account to the variable "$sAdminAcct" and then added the variable to the "_Account..." functions in place of "administrator". However, like it says above, the variable is blank. I enter all the credentials required, but it won't change the name. Any ideas how to get it to work?
-
I did the script with the UDF and it was awesome! nifty little scripting there (shout out to @engine for the great work). The example to run an Admin prompt was really helpful too. I got it working on some other scripts. Thanks again!
- 6 replies
-
- windows 10
- autoit
-
(and 1 more)
Tagged with:
-
Got it to work! Thanks @InunoTaishou the example was perfect.
- 5 replies
-
- _crypt_hashdata
- autoit
-
(and 2 more)
Tagged with:
-
Thanks guys. @InunoTaishou That is a nice little example there. the syntax makes a lot more sense, and from that I can grasp the implementation. Also, I understand that AutoIT isn't the most secure, and we will look at some other solutions. Really though, the big goal is to not have the passwords show up in various i house admin tools that run using administrator credentials and the security risk isn't so great as to stop using them. Those threads were really interesting though, and made me aware of some risks that I did not understand. Good links.
- 5 replies
-
- _crypt_hashdata
- autoit
-
(and 2 more)
Tagged with:
-
That is a really great question @JLogan3o13. I hadn't even thought to do that. A team lead asked if we could make a script to do it, but it would be much easier in active directory. I'll ask him about that today. Also, @AdamUL... That is great! Much easier process for local account management. I can avoid the cmd altogether with those commands right? However, for the sake of learning, how do I get the cmd to open in an elevated box within an auto it script? We do a lot of scripting and many of our scripts need to operate with administrator permissions. Forgetting the rest of my code (if that is alright), why does this command open a standard cmd window instead of the administrator cmd prompt? RunAs("administrator",@ComputerName,$sAdminPassword,0,@ComSpec)
- 6 replies
-
- windows 10
- autoit
-
(and 1 more)
Tagged with:
-
I am creating a script that changes important account information, including passwords and usernames, but I can't take the input from a user at runtime. I could get the script to work with the information included in variables, but that is a security risk we want to avoid. As far as I can tell, _Crypt_HashData or possible _Crypt_EncryptData are how I would go about this. I looked at the help file and I am struggling to understand the implementation. Do I need an external document with the info? That would present the same issue. Do I need to create the variable and then run the function in another script and then add it in? I am quite lost. Could somone give me a basic step-by-step rundown?
- 5 replies
-
- _crypt_hashdata
- autoit
-
(and 2 more)
Tagged with:
-
I need to create a new administrator account on a number of computers, so figured I would make a script to do it. You can only add/modify admin profile from an elevated command prompt (administrator command prompt). So I tried writing that into my short script. I thought that my "RunAs" command below would do the trick, but it opens a standard cmd window through the admin profile. Anyone able to tell me how to get it to open the elevated cmd? RunAs("administrator",@ComputerName,$sAdminPassword,0,@ComSpec) Sleep (500) Send("net user /ADD " & $sUsername & " " & $sPassword) Send("{ENTER}") Send("Y") Send("{ENTER}") Send("net user " & $sUsername & " /passwordchg:no") Send("{ENTER}") Send("net localGroup administrators " & $sUsername & " /ADD") Send("{ENTER}") WinClose("C:\Windows\system32\cmd.exe")
- 6 replies
-
- windows 10
- autoit
-
(and 1 more)
Tagged with: