Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
;*************************************************************************** ;** UAC.wbt ;** This script allows you turn off the Windows Vista UAC ;** Reboot the computer (which is necessary) ;** Then run other procedures ;** Turn the UAC back on ;** Reboot the computer again ;** ;** Mark S, Daugherty ;** Practical Solutions, Inc ;** 5/16/07 ;*************************************************************************** loaddrv = DirGet() ;get the path where the procedure is loading from winchk = WinVersion(1) ;Check for Windows Vista platform Select winchk Case 6 ;This is a Vista computer, so continue with procedure to turn the UAC off if necessary passchk = param0 Select passchk ;check to see if any parameters have been passed to the procedure on startup Case 0 ; No parameters have been passed. This is the initial run through the code ;check to see if the UAC is on uacchk = RegQueryValue(@REGMACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System[EnableLUA]") If uacchk == 1 ;UAC is ON ;Run dialog to turn UAC off and reboot computer UacDialogFormat=`WWWDLGED,6.1` UacDialogCaption=`UAC Set` UacDialogX=175 UacDialogY=095 UacDialogWidth=154 UacDialogHeight=065 UacDialogNumControls=003 UacDialogProcedure=`DEFAULT` UacDialogFont=`DEFAULT` UacDialogTextColor=`DEFAULT` UacDialogBackground=`DEFAULT,255|255|255` UacDialogConfig=0 UacDialog001=`029,045,040,012,PUSHBUTTON,DEFAULT,"Reboot",1,1,32,"Microsoft Sans Serif|7680|70|34","0|0|0",DEFAULT` UacDialog002=`081,045,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,"Microsoft Sans Serif|7680|70|34","0|0|0",DEFAULT` UacDialog003=`007,005,140,034,STATICTEXT,DEFAULT,"This installation procedure requires a reboot of the computer. Please close all open applications and then click the Reboot button to continue.",DEFAULT,5,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|255",DEFAULT` ButtonPushed=Dialog("UacDialog") ;turn the UAC off RegSetDword(@REGMACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System[EnableLUA]", 0) ;Set the Windows Registry RunOnce key to restart the procedure after rebooting - a parameter is passed to be picked up by the procedure on restart RegSetValue(@REGMACHINE, "Software\Microsoft\Windows\CurrentVersion\RunOnce[uac.exe]","%loaddrv%uac.exe 1") IntControl(67,0,0,0,0) ; reboot computer Else ;UAC is already off so no action need to be taken other than to continue the procedure Message("UAC off","The UAC is already off, Please continue") EndIf Break Case 1 ;A parameter has been passed so this is the second run of the procedure after the UAC has been turned off ;Since the UAC is turned off you can run any necessary procedures here Message("GO","Please run your procedure") ;After running your code you come back here and reset the UAC RegSetDword(@REGMACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System[EnableLUA]", 1) EndDialogFormat=`WWWDLGED,6.1` EndDialogCaption=`UAC Set` EndDialogX=175 EndDialogY=095 EndDialogWidth=154 EndDialogHeight=047 EndDialogNumControls=003 EndDialogProcedure=`DEFAULT` EndDialogFont=`DEFAULT` EndDialogTextColor=`DEFAULT` EndDialogBackground=`DEFAULT,255|255|255` EndDialogConfig=0 EndDialog001=`029,029,040,012,PUSHBUTTON,DEFAULT,"Reboot",1,1,32,"Microsoft Sans Serif|7680|70|34","0|0|0",DEFAULT` EndDialog002=`081,029,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,"Microsoft Sans Serif|7680|70|34","0|0|0",DEFAULT` EndDialog003=`007,005,140,018,STATICTEXT,DEFAULT,"This installation procedure is complete. Please click the Reboot button to finish.",DEFAULT,5,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|255",DEFAULT` ButtonPushed=Dialog("EndDialog") IntControl(67,0,0,0,0) ; reboot computer Break EndSelect Break Case winchk ;This is not a Vista computer so the entire procedure can be skipped Message("Not Vista","Please continue with procedure") Break EndSelect Exit
Article ID: W17296
File Created: 2007:07:03:14:29:24
Last Updated: 2007:07:03:14:29:24