Editor's Note: Share your scripting discoveries, comments, problems, solutions, and experiences with products. Email your contributions (500 words or less) to [email protected]. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100.\]
My organization has standard business application software that resides on 700 Windows 2000 Professional machines. Upgrading the software (i.e., running apps_upgrade.exe) requires administrator rights. We don't want users to know the local administrator's password; therefore, we can't use the RunAs command because it prompts for a password. We could theoretically use Win2K's Group Policy to roll out the software upgrade, but our corporate IT department doesn't give us permission to create or modify policies.
To solve the problem, I downloaded Jonathan Bennett's freeware scripting tool AutoIt 3.0 (http://www.autoitscript.com/autoit3). This tool lets you write scripts that resemble Visual Basic (VB) and compile code into .exe binary format.
First, I created an Active Directory (AD) domain user called domain\appsinstaller and put it in an AD global group I created called apps_grp. My organization's standard practice is to place this global group in the Administrators group on all local machines. This technique, called AGLP (for Accounts, Global, Local, Permissions), makes domain\appsinstaller a user with administrator rights on all local machines. Next, I used AutoIt and Notepad to write the script Myapps.au3, which Listing 1 shows, and compiled the script into an .exe file (i.e., myapps.exe). Users can then simply run the file myapps.exe to upgrade the software.