MeepZero
Active Members-
Posts
37 -
Joined
-
Last visited
MeepZero's Achievements
Seeker (1/7)
0
Reputation
-
I've been digging around for awhile on this one actually to find the way that best suits me. Thats how I ended up thinking I'd go this route for this app. How are you specifying credentials for the autoit app being run? Originally I wanted this to all just run through one autoit script to make things really simple. I was under the impression that running msiexec on the installer was going to cause problems because of the way SCCM executes things. Is there a best way to run msiexec using autoit deployed by SCCM that you know of? This has been driving me crazy for weeks
-
How does using RunWait work better compared to ShellExecuteWait? Does RunWait run the command under the account that is running the autoit exe? SCCM 2012, we are working on the SP1 upgrade but its still a little ways out. Are you talking about using a task sequence? How do you do the pop up messages?
-
Sorry for the slow response, I couldn't answer the question originally because I didn't know how SCCM handled things. It looks like SCCM executes files based on the SYSTEM account. There is an option that lets you allow user interaction with the files being executed by SCCM however that I have successfully tested in the past (just not with MSIs). Everything is being run locally from C:Windowsccmcache(some randomly assigned folder) I have also applied the double quotes suggestion. So far the process is still erroring out, so I don't think its working correctly.
-
We are preparing to deploy mimecast to our end users within our company, however the MSI installer requires that the user be out of Outlook first. What I'd like to do is use AutoIT to handle prompting the user to close their work, kill outlook, and then go ahead with the MSI installation under /q with a nice splash screen to keep their attention while it runs. It will get distributed to the company via SCCM. Here's what I have so far... ;the following two lines are not in use...;$sUserName = 'administrator' ;$sPassword = 'password for the local admin account' $sDomain = @ComputerName $pathToMSI = @WorkingDir & "\MimecastServicesforOutlook4.1.465.5462_32_bit.msi" MsgBox(0,"test","Installing Mimecast",10) SplashTextOn("Please wait...","Checking if outlook is still open...",400,200) While ProcessExists("outlook.exe") ProcessClose("outlook.exe") Sleep(50) WEnd SplashOff() SplashTextOn("Please wait...","Installing Mimecast. Please wait.",400,200) ;not sure if the following line is needed... ;RunAs($sUserName, $sDomain, $sPassword, 0, @AutoItExe, @SystemDir, @SW_HIDE) $file = ShellExecuteWait('msiexec', "/i " & $pathToMSI & " /q") If $file = 0 Then ConsoleWrite("Failed to install Mimecast"& @CRLF) EndIf SplashOff() MsgBox(0,"Installation Complete","Mimecast has been installed on your computer.") Right now, the script itself seems to run fine, I get all the pop up boxes. I don't think that the msi installer is running though, any ideas on what I can change to fix this?
-
Adding local admins using @ComSpec and net localgroup
MeepZero replied to MeepZero's topic in AutoIt General Help and Support
That fixed it BrewMan, thanks for pointing the blunder out -
I'm trying to run the following to add local admins on a freshly imaged machine... $test = "username" RunWait(@ComSpec & " /c " & "net localgroup administrators domain\" & $test & " /add", @SW_HIDE) ConsoleWrite(@ComSpec & " /c " & "net localgroup administrators domain\" & $test & " /add") When I take the console output and copy paste that into the Run box in windows, it runs fine. When I run the script, the local admin doesn't get added in. Any ideas what I'm doing wrong here?
-
Outputting to a file and then reading from the file
MeepZero replied to MeepZero's topic in AutoIt General Help and Support
That did it, thanks a ton for the help -
I'm trying to make some code to throw into the end of one script and at the begining of another. The idea is when we image new machines, the current script needs to reboot the machine to continue our processes, but when it comes back up I'd like it to retain the entered information from the first boot. I've got the top section working, it will take some inputs and then write them to the first few lines of a file. Then in the second section it is supposed to read those three lines and push them into an array. I thought about just using three variables but it seemed easier to use an array instead since the while loop complicated things. Apologies for the lack of tabs, they never seem to carry over when I copy paste this stuff into the forum forms. ;This code is left in the first script Global $OutUser, $OutPass, $OutOwner $OutOwner = "Owner" $OutPass = "Pass" $OutUser = "User" ;$value = InputBox ( "Title", "Enter IP.", "", "" ) $file = FileOpen ( "C:\temp\PrepTemp.txt", 1 ) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file,$OutUser) FileWriteLine($file,$OutPass) FileWriteLine($file,$OutOwner) ConsoleWrite("finished writing to file, closing" & @CRLF) ;FileWrite ( $file, $value ) ;Output file and data going to said file FileClose ( $file ) ConsoleWrite("Resetting variables" & @CRLF) $OutOwner = "FAIL" $OutPass = "FAIL" $OutUser = "FAIL" ;From here forward, code is moved into the begining of the next script so it can read what was left behind previously. Global $cred[3] $file = FileOpen ( "C:\temp\PrepTemp.txt", 0 ) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ConsoleWrite("trying to do magic" & @CRLF) While 1 Local $line = FileReadLine($file) ConsoleWrite($line & @CRLF) Local $var $var = 0 $cred[$var] = $line If @error = -1 Then ExitLoop $var = $var + 1 WEnd ConsoleWrite($cred[0] & @CRLF) ConsoleWrite($cred[1] & @CRLF) ConsoleWrite($cred[2] & @CRLF) In its current form, I can't get the script to actually output anything in the console and show what was in the file. Any ideas on this?
-
Unfortunately, this isn't an option for me. I'm on the desktop support side of the company and we don't have access to the group policy settings from our side. Whats really frustrating about this, is I can manually (or through a script, though the script is kinda random) go and change the local admin group to contain the needed users / groups and all it does is ask me for my login. It only seems to throw a fit when I try to do it via the command line. I can reboot the machine and it works fine, but the goal here is to do everything (domain add, machine rename, local groups, install apps, etc) in a single pass without either needing multiple reboots OR needing to log in as myself to handle the rest of the setup. I think I might have better luck if I can pull up just the properties box of the local administrators group somehow and bypass the lusrmgr.msc screen. I've searched around for this but I haven't had the best luck with finding that either.
-
I had it set up for this actually, but I can't make it work because there is a limitation where once you rename and add a machine to the domain, you must reboot before being able to use this command. I want to do all of this before rebooting. I'll take a look at the link there, it might be helpful in making this work.
-
Here's what I have so far, I'm getting hung up on calling up the properties window for the admin group. The local users and groups panel is weird and sluggish to launch, maybe there's a better way to call up the properties of the local admin group somehow? That module stuff is something I put in so I can plug this in as a function to another script while still leaving this one intact. AutoItSetOption("TrayIconDebug",1) Global $module, $OutOWNER If $module = 0 Then AutoItSetOption("WinTitleMatchMode" ,2) AddLocalAdmin() EndIf Func AddLocalAdmin() ShellExecute("lusrmgr.msc") $uWhndLUG = WinWait("lusrmgr - [Local Users and Groups (Local)") WinWaitActive($uWhndLUG) ControlSend($uWhndLUG,"",12785,"g") WinWait($uWhndLUG,"Local Users and Groups (Local)Groups") Sleep(2500) ControlSend($uWhndLUG,"",12786,"Admin{enter}") WinWait("Administrators Properties") ; Waiting for admin properties box to appear ControlClick("Administrators Properties","",1168) WinWait("Select Users, Computers, Service Accounts, or Groups") ControlSend("Select Users, Computers, Service Accounts, or Groups","",214,$OutOWNER & "{enter}") WinWaitActive("Administrators Properties") ControlClick("Administrators Properties","",1168) WinWait("Select Users, Computers, Service Accounts, or Groups") ControlSend("Select Users, Computers, Service Accounts, or Groups","",214,"ANOTHERGROUP{enter}") ;Might need something in here to catch a popup for duplicate entries will probably be like... ;If WinExists("Local Users and Groups"," is already in the list.") Then ; Close it WinWaitActive("Administrators Properties") ControlClick("Administrators Properties","",1) WinClose($uWhndLUG) EndFunc
-
I've looked into the AD UDF, but I'm not entirely sure how to use it. I think I want to use the _AD_AddUserToGroup item, but from reading through it it sounds like this is something that needs to run on the server, this needs to run on the workstation after the machine has been renamed and added to the domain, but before the first reboot. Digging around in the forums hasn't yielded the best results for me, its difficult to find something that does all of this on the local machine.
-
I'm trying to build a script or function to integrate into my master script so after I run this on the client machine, it will rename and add itself to the domain. It also needs to add a couple users to the local admin group in Windows 7. So far I've been able to build something that navigates through the windows UI and takes care of adding to the domain, but now I'm hung up on adding users to the local admin group. I thought about just manually mapping out mouseclicks and trying to get it to run that way, but I'm hoping there is an easier way somehow. Is there a way to add a user to the local admin group without needing to reboot the machine first? I've tried using "net localgroup" but that seems to not work if you run it after both renaming and adding a machine to the domain. It does work if you only add the machine and not rename it but that creates new problems that I really don't want to deal with.
-
What if I wanted to test if the user entered anything into the box and reset the variable to "" if they didn't. I'm thinking maybe have it test the variable and see if there are more than 5 characters in it. If more than 5 than keep it, if less, replace it with an empty string. What kind of exp<b></b>ression would I ues to test for that kind of condition? Edit: looks like StringLen is what I need, doh!