For example it can enable remote desktop on a remote machine and then reboot it.
Plain Text
; ---------------------------------------------------------------------------- ; Set up our defaults ; ---------------------------------------------------------------------------- ;AutoItSetOption("MustDeclareVars", 1) ;AutoItSetOption("MouseCoordMode", 0) ;AutoItSetOption("PixelCoordMode", 0) ;AutoItSetOption("RunErrorsFatal", 0) ;AutoItSetOption("TrayIconDebug", 1) ;AutoItSetOption("WinTitleMatchMode", 4) ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- #INCLUDE ("C:\Program Files\AutoIt3\Include\GUIConstants.au3") ;Script generated by AutoBuilder 0.4 - but modified Opt("GUICoordMode", 1) Opt("GUINotifyMode", 1) Global $PCNAME Global $GUI_CHECKED = 1 Global $EM_SETSEL = 0xB1 Global $winTitle = "IT Console of the Gods (Certified Geniuses Only)" GuiCreate($winTitle, 600,440,(@DesktopHeight-400)/2, (@DesktopHeight-300)/2 , 0x04CF0000) ;Create GUI Fields $group1 = GUISetControl("group", "Registry Modifications", 5, 5, 590, 85, 0x00020000) $radio_1 = GUISetControl("radio", "Local Computer", 10, 20, 95, 20) GUISetControlEx($radio_1, $GUI_CHECKED) $radio_2 = GUISetControl("radio", "Remote Computer", 108, 20, 110, 20) $input_2 = GUISetControl("input", "", 218, 20, 150, 20) GUISetControlEx($input_2, 128) $button_2 = GUISetControl("button", "Verify Connectivity", 373, 20, 120, 20) GUISetControlEx($button_2, 128) $label_2 = GUISetControl("label", "", 498, 23, 95, 20) $button_3 = GUISetControl("button", "SUS Policies", 10, 45, 80, 20) $button_4 = GUISetControl("button", "CWD Catalog CD Registry Entries", 93, 45, 200, 20) $button_5 = GUISetControl("button", "Enable XP Remote Desktop", 297, 45, 145, 20) $button_9 = GUISetControl("button", "Disable Archive/AutoArchive", 447, 45, 145, 20) $button_10 = GUISetControl("button", 'Repair "Customize Outlook Today"', 10, 65, 180, 20) $button_11 = GUISetControl("button", "Never Be A Master Browser", 194, 65, 150, 20) $button_11 = GUISetControl("button", "Disable Outlook Attachment Security", 347, 65, 200, 20) GUISetControl("group", "Computer Management", 5, 95, 590, 45, 0x00020000) $label_3 = GUISetControl("label", "Target Device:", 10, 115, 95, 20) $input_3 = GUISetControl("input", "", 90, 115, 95, 20) $button_6 = GUISetControl("button", "Ping Device", 190, 115, 95, 20) $label_4 = GUISetControl("label", "", 290, 117, 95, 20) $button_7 = GUISetControl("button", "Restart Device", 390, 115, 95, 20) $button_8 = GUISetControl("button", "Shutdown Device", 490, 115, 95, 20) ;Display GUI Windows and monitor for changes GuiShow() WinActivate($winTitle) While 1 sleep(100);prevent maxing-out the CPU $msg = GuiMsg(0) Select Case $msg = -3;close button 'x' in corner Exit Case $msg = $input_2 GuiWrite($label_2, 0, "");clear label Case $msg = $radio_1 GuiWrite($input_2, 0, "");clear input box GuiWrite($label_2, 0, "");clear label GUISetControlEx($input_2, 128) GUISetControlEx($button_2, 128) GUISetControlEx($radio_2, 4) Case $msg = $radio_2 GUISetControlEx($input_2, 64) ControlFocus($winTitle,"","Edit1") GUISetControlEx($radio_1, 4) GUISetControlEx($button_2, 64) ; hackish way to give the input box focus ; you really shouldn't mix gui refs with controlcommands.... Case $msg = $button_2 $pcname = GuiRead($input_2) If $pcname = "" Then Msgbox(4096, "Error", "Please enter a value in the remote computer field, or select local computer") Else $Ping = "" $Ping = Ping ($pcname) If $Ping = 1 Then GuiWrite($label_2, 0, "Connection Verified") EndIf If $Ping = 0 Then GuiWrite($label_2, 0, "Connection Failed") EndIf If $Ping = 2 Then GuiWrite($label_2, 0, "") EndIf EndIf Case $msg = $button_3 $1 = "" $1 = CheckFocus() If $1 = 0 OR $1 = 1 Then SUS() Case $msg = $button_4 $1 = "" $1 = CheckFocus() If $1 = 0 OR $1 = 1 Then CApass() Case $msg = $button_5 $1 = "" $1 = CheckFocus() If $1 = 0 OR $1 = 1 Then RDS() Case $msg = $button_6 GuiWrite($label_4, 0, "");clear label $1 = "" $1 = GuiRead($input_3) If $1 = "" Then Msgbox(4096, "Error", "Please enter a value in the Target Device field.") Else $Ping = "" $Ping = Ping ($1) If $Ping = 1 Then GuiWrite($label_4, 0, "Connection Verified") EndIf If $Ping = 0 Then GuiWrite($label_4, 0, "Connection Failed") EndIf If $Ping = 2 Then GuiWrite($label_4, 0, "") EndIf EndIf Case $msg = $button_7 $1 = "" $1 = GuiRead($input_3) If $1 = "" Then Msgbox(4096, "Error", "Please enter a value in the Network Device field.") Else RestartC($1) EndIf Case $msg = $button_8 $1 = "" $1 = GuiRead($input_3) If $1 = "" Then Msgbox(4096, "Error", "Please enter a value in the Network Device field.") Else ShutDownC($1) EndIf Case $msg = $button_9 $1 = "" $1 = CheckFocus() If $1 = 0 OR $1 = 1 Then Archive() Case $msg = $button_10 $1 = "" $1 = CheckFocus() If $1 = 0 OR $1 = 1 Then Outlook() Case $msg = $button_11 $1 = "" $1 = CheckFocus() If $1 = 0 OR $1 = 1 Then MasterBrowser() Case $msg = $button_11 $1 = "" $1 = CheckFocus() If $1 = 0 OR $1 = 1 Then AttachmentSec() EndSelect WEnd Exit ;____________________________________________________ ;Custom Function Calls ;____________________________________________________ Func CheckFocus() ;RC's 0 = Local 1 = remote with target field filled in. 2 = remote with target field blank. $1 = "" $2 = "" $3 = "" $1 = GUIRead($radio_1) $2 = GUIRead($radio_2) $3 = GUIRead($input_2) If $1 = 1 Then Return 0 EndIf If $2 = 1 AND $3 <> "" Then Return 1 EndIf If $2 = 1 AND $3 = "" Then MsgBox(4096,"Validating Target", "You have not selected a valid target. The requested registry modifcation will not be performed.") Return 2 EndIf EndFunc Func Ping($dest) ;Function RC's 1 = good ping 0 = bad ping 2 = missing file If FileExists(@SCRIPTDIR & "\alive.exe") = 0 Then MSgBox(4096,"Error","Alive.exe could not be found in " & @SCRIPTDIR) Return 2 Else $Return = RUNWAIT(@SCRIPTDIR & "\alive.exe /REPEAT=3 /TIMEOUT=1 " & $dest, @SCRIPTDIR, @SW_hide) If $Return = 0 Then Return 1 Else Return 0 EndIf EndIf EndFunc Func SUS() $dest = "" $error = 0 If $pcname <> "" Then $dest = "\\" & $PCNAME & "\" EndIf $OS = REGREAD($dest & "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName") $SP = REGREAD($dest & "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVERSION") $SP = StringRight($SP, 1) If $OS = "Microsoft Windows XP" OR ($OS = "Microsoft Windows 2000" AND $SP >= 3) Then ProgressOn("SUS Registry Configuration", "SUS Registry Configuration", "Writing value 1 of 10") ProgressSet(10) If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "WUServer", "REG_SZ", "<a href='http://appserver1' class='bbc_url' title='External link' rel='nofollow external'>http://appserver1"</a>) = 0 Then $error = $error + 1 ProgressSet(20, "Writing value 2 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "WUStatusServer", "REG_SZ", "<a href='http://appserver1' class='bbc_url' title='External link' rel='nofollow external'>http://appserver1"</a>) = 0 Then $error = $error + 1 ProgressSet(30, "Writing value 3 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", "REG_DWORD", "4") = 0 Then $error = $error + 1 ProgressSet(40, "Writing value 4 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", "REG_DWORD", "0") = 0 Then $error = $error + 1 ProgressSet(50, "Writing value 5 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "ScheduledInstallDay", "REG_DWORD", "0") = 0 Then $error = $error + 1 ProgressSet(60, "Writing value 6 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "ScheduledInstallTime", "REG_DWORD", "4") = 0 Then $error = $error + 1 ProgressSet(70, "Writing value 7 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "UseWUServer", "REG_DWORD", "1") = 0 Then $error = $error + 1 ProgressSet(80, "Writing value 8 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "RescheduleWaitTime", "REG_DWORD", "2") = 0 Then $error = $error + 1 ProgressSet(90, "Writing value 9 of 10") If REGWRITE($dest & "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoRebootWithLoggedOnUsers", "REG_DWORD", "1") = 0 Then $error = $error + 1 ProgressSet(98, "Writing value 10 of 10") If REGWRITE($dest & "HKLM\SYSTEM\CurrentControlSet\Services\wuauserv", "Start", "REG_DWORD", "2") = 0 Then $error = $error + 1 ProgressSet(100) ProgressOff() If $error > 0 AND $error <> 100 Then MsgBox(4096,"SUS Registry Configuration", "An errors occured while merging one or more of the SUS Registry entries. Please verify the computer is online and you have the proper permissions.") If $error = 0 Then MsgBox(4096,"SUS Registry Configuration", "All registry entries have been successfully written.") Else MsgBox(4096,"SUS Registry Configuration", "SUS Registry entries not merged. The OS and or Service Pack level does not appear to be compatible or could not be determined.") EndIf EndFunc Func CApass() $dest = "" If $pcname <> "" Then $dest = "\\" & $PCNAME & "\" EndIf $error = 0 ProgressOn("CWD Catalog CD Registry Entries", "Client Access Password Lookup Utility", "Writing value 1 of 11") ProgressSet(10) If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}", "@", "REG_SZ", "Microsoft Hierarchical FlexGrid Control, Version 6.0 (OLEDB)") = 0 Then $error = $error + 1 ProgressSet(20, "Writing value 2 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\Control", "", "REG_SZ", "") = 0 Then $error = $error + 1 ProgressSet(35, "Writing value 3 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\InprocServer32", "@", "REG_SZ", "D:\MSHFLXGD.OCX") = 0 Then $error = $error + 1 ProgressSet(35, "Writing value 4 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\InprocServer32", "ThreadingModel", "REG_SZ", "Apartment") = 0 Then $error = $error + 1 ProgressSet(45, "Writing value 5 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\MiscStatus", "@", "REG_SZ", "0") = 0 Then $error = $error + 1 ProgressSet(55, "Writing value 6 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\MiscStatus\1", "@", "REG_SZ", "131473") = 0 Then $error = $error + 1 ProgressSet(65, "Writing value 7 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\ProgID", "@", "REG_SZ", "MSHierarchicalFlexGridLib.MSHFlexGrid.6") = 0 Then $error = $error + 1 ProgressSet(75, "Writing value 8 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\ToolboxBitmap32", "@", "REG_SZ", "D:\MSHFLXGD.OCX, 1") = 0 Then $error = $error + 1 ProgressSet(85, "Writing value 9 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\TypeLib", "@", "REG_SZ", "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}") = 0 Then $error = $error + 1 ProgressSet(90, "Writing value 10 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\Version", "@", "REG_SZ", "6.0") = 0 Then $error = $error + 1 ProgressSet(98, "Writing value 11 of 11") If REGWRITE($dest & "HKCR\CLSID\{0ECD9B64-23AA-11D0-B351-00A0C9055D8E}\VersionIndependentProgID", "@", "REG_SZ", "MSHierarchicalFlexGridLib.MSHFlexGrid") = 0 Then $error = $error + 1 ProgressOff() If $error = 0 Then MsgBox(4096,"CWD Catalog CD Registry Entries", "All registry entries have been successfully written.") Else MsgBox(4096,"CWD Catalog CD Registry Entries", "An error occured while merging the registry entry requested. Please verify the computer is online and you have the proper permissions.") EndIf EndFunc Func RDS() $dest = "" If $pcname <> "" Then $dest = "\\" & $PCNAME & "\" EndIf $error = 0 $OS = REGREAD($dest & "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName") If $OS = "Microsoft Windows XP" Then ProgressOn("Remote Desktop Services", "Enable Remote Desktop Services", "Writing value 1 of 1") ProgressSet(50) If REGWRITE($dest & "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server", "fDenyTSConnections", "REG_DWORD", "0") = 0 Then $error = $error + 1 ProgressSet(100) ProgressOff() If $error = 0 Then If MsgBox(4096+4,"Remote Desktop Services", "Registry entry merged, would you like to restart the computer now?") = 6 Then If $pcname = "" Then RunWait(@WINDOWSDIR & "\System32\shutdown.exe -r -t 00 -f", @WINDOWSDIR & "\System32", @SW_HIDE) Else RunWait(@WINDOWSDIR & "\System32\shutdown.exe -r -m \\" & $PCNAME & " -t 00 -f", @WINDOWSDIR & "\System32", @SW_HIDE) EndIf EndIf Else MsgBox(4096,"Remote Desktop Services", "An error occured while merging the registry entry requested. Please verify the computer is online and you have the proper permissions.") EndIf Else MsgBox(4096,"Remote Desktop Services", "This option is only valid on Windows XP Systems. The system you selected is not running Windows XP or the operating system could not be determined.") EndIf EndFunc Func ShutDownC($dest) ;psshutdown.exe 0 = good 1 = bad If MsgBox(4096+4,"Remote Shutdown Request", "Are you sure you want to shutdown the device " & $dest & "?") = 6 Then If RunWait("psshutdown.exe -s -f -t 00 \\" & $dest, @WINDOWSDIR & "\System32", @SW_HIDE) = 0 Then MsgBox(4096,"Remote Shutdown Request", "Your shutdown request was accepted.") Else MsgBox(4096,"Remote Shutdown Request", "Your shutdown request was not accepted. Remember this command is only valid for PC's.") EndIf EndIf EndFunc Func RestartC($dest) ;psshutdown.exe 0 = good 1 = bad If MsgBox(4096+4,"Remote Restart Request", "Are you sure you want to restart the device " & $dest & "?") = 6 Then If RunWait("psshutdown.exe -r -f -t 00 \\" & $dest, @WINDOWSDIR & "\System32", @SW_HIDE) = 0 Then MsgBox(4096,"Remote Restart Request", "Your restart request was accepted.") Else MsgBox(4096,"Remote Restart Request", "Your restart request was not accepted. Remember this command is only valid for PC's.") EndIf EndIf EndFunc Func Outlook() $dest = "" If $pcname <> "" Then $dest = "\\" & $PCNAME & "\" EndIf $error = 0 ProgressOn("Repairing Customize Outlook Today", "Repairing Customize Outlook Today", "Writing value 1 of 1") ProgressSet(50) If REGWRITE($dest & "HKLM\SOFTWARE\Microsoft\Internet Explorer\Application Compatibility", "Outlook.exe", "REG_DWORD", "1") = 0 Then $error = $error + 1 ProgressSet(100) ProgressOff() If $error = 0 Then MsgBox(4096,"Repairing Customize Outlook Today", "Registry entry merged, Outlook must be restarted for the change to take effect") Else MsgBox(4096,"Repairing Customize Outlook Today", "An error occured while merging the registry entry requested. Please verify the computer is online and you have the proper permissions.") EndIf EndFunc Func Archive() $dest = "" If $pcname <> "" Then $dest = "\\" & $PCNAME & "\" EndIf $error = 0 ProgressOn("Disable Outlook Archive Functions", "Repairing Customize Outlook Today", "Writing value 1 of 3") ProgressSet(30) If REGWRITE($dest & "HKLM\Software\Microsoft\Office\9.0\Outlook", "DisablePST", "REG_DWORD", "1") = 0 Then $error = $error + 1 ProgressSet(60, "Writing value 2 of 3") If REGWRITE($dest & "HKLM\Software\Microsoft\Office\10.0\Outlook", "DisablePST", "REG_DWORD", "1") = 0 Then $error = $error + 1 ProgressSet(85, "Writing value 3 of 3") If REGWRITE($dest & "HKLM\Software\Microsoft\Office\11.0\Outlook", "DisablePST", "REG_DWORD", "1") = 0 Then $error = $error + 1 ProgressSet(100) ProgressOff() If $error = 0 Then MsgBox(4096,"Disable Outlook Archive Functions", "All registry entries have been successfully written.") Else MsgBox(4096,"Disable Outlook Archive Functions", "An error occured while merging the registry entry requested. Please verify the computer is online and you have the proper permissions.") EndIf EndFunc Func MasterBrowser() $dest = "" If $pcname <> "" Then $dest = "\\" & $PCNAME & "\" EndIf $error = 0 ProgressOn("Master Browser Configuration", 'Configuring PC to "Never Be A Master Browser"', "Writing value 1 of 2") ProgressSet(35) If REGWRITE($dest & "HKLM\SYSTEM\CurrentControlSet\Services\Browser\Parameters", "IsDomainMaster", "REG_SZ", "FALSE") = 0 Then $error = $error + 1 ProgressSet(75, "Writing value 2 of 2") If REGWRITE($dest & "HKLM\SYSTEM\CurrentControlSet\Services\Browser\Parameters", "MaintainServerList", "REG_SZ", "NO") = 0 Then $error = $error + 1 ProgressSet(100) ProgressOff() If $error = 0 Then MsgBox(4096,"Master Browser Configuration", 'All registry entries have been successfully written. The PC is now configured to "Never Be A Master Browser" The computer must be restarted for the changes to take effect.') Else MsgBox(4096,"Master Browser Configuration", "An error occured while merging the registry entry requested. Please verify the computer is online and you have the proper permissions.") EndIf EndFunc Func AttachmentSec() $dest = "" If $pcname <> "" Then $dest = "\\" & $PCNAME & "\" EndIf $error = 0 ProgressOn("Outlook Attachment Security", "Disable Outlook Attachment Security", "Writing value 1 of 3") ProgressSet(35, "Writing value 1 of 3") If REGWRITE($dest & "HKU\S-1-5-21-1831097469-1773692841-1233803906-2084\Software\Microsoft\Office\9.0\Outlook\Security", "Level1Remove", "REG_SZ", ".ade;.adp;.app;.asx;.bas;.bas;.bat;.cer;.chm;.cmd;.com;.cpl;.crt;.csh;.exe;.fxp;.hlp;.hta;.inf; .ins;.isp;.js;.jse;.ksh;.lnk;.mda;.mdb;.mdt;.mdw;.mde;.mdz;.msc;.msi;.msp;.mst;.ops;.pcd;.pif;.prf;. prg;.pst;.reg;.scf;.scr;.sct;.shb;.shs;.url;.vb;.vbe;.vbs;.wsc;.wsf;.wsh") = 0 Then $error = $error + 1 ProgressSet(55, "Writing value 2 of 3") If REGWRITE($dest & "HKU\S-1-5-21-1831097469-1773692841-1233803906-2084\Software\Microsoft\Office\10.0\Outlook\Security", "Level1Remove", "REG_SZ", ".ade;.adp;.app;.asx;.bas;.bas;.bat;.cer;.chm;.cmd;.com;.cpl;.crt;.csh;.exe;.fxp;.hlp;.hta;.inf; .ins;.isp;.js;.jse;.ksh;.lnk;.mda;.mdb;.mdt;.mdw;.mde;.mdz;.msc;.msi;.msp;.mst;.ops;.pcd;.pif;.prf;. prg;.pst;.reg;.scf;.scr;.sct;.shb;.shs;.url;.vb;.vbe;.vbs;.wsc;.wsf;.wsh") = 0 Then $error = $error + 1 ProgressSet(80, "Writing value 3 of 3") If REGWRITE($dest & "HKU\S-1-5-21-1831097469-1773692841-1233803906-2084\Software\Microsoft\Office\11.0\Outlook\Security", "Level1Remove", "REG_SZ", ".ade;.adp;.app;.asx;.bas;.bas;.bat;.cer;.chm;.cmd;.com;.cpl;.crt;.csh;.exe;.fxp;.hlp;.hta;.inf; .ins;.isp;.js;.jse;.ksh;.lnk;.mda;.mdb;.mdt;.mdw;.mde;.mdz;.msc;.msi;.msp;.mst;.ops;.pcd;.pif;.prf;. prg;.pst;.reg;.scf;.scr;.sct;.shb;.shs;.url;.vb;.vbe;.vbs;.wsc;.wsf;.wsh") = 0 Then $error = $error + 1 ProgressSet(100) ProgressOff() If $error = 0 Then MsgBox(4096,"Outlook Attachment Security", "Outlook Attachment Security has been disabled you should restart outlook for teh changes to take effect.") Else MsgBox(4096,"Outlook Attachment Security", "An error occured while merging the registry entry requested. Please verify the computer is online and you have the proper permissions.") EndIf EndFunc
Attached Files
Edited by ken82m, 28 November 2008 - 09:30 PM.






