Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

turn off uac

Posted on 2008-10-04
15
Medium Priority
?
5,580 Views
Last Modified: 2010-04-21
vbs code to turn off UAC in vista
0
Comment
Question by:ankur3020
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
15 Comments
 
LVL 5

Assisted Solution

by:si_shamil
si_shamil earned 2000 total points
ID: 22643590
You dont need to use VBScript for that

just type one command in the command line


 Disable UAC
 C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
 
 Enable UAC
 C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f

or make batch, the run it from command line with argument (1 enable UAC, 0 Disable)
Example UAS.bat 1 or UAC.bat 0:

@echo off
 
C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d %1 /f

Open in new window

0
 

Author Comment

by:ankur3020
ID: 22643718
i need to change the status with vbs,pls provide code.
0
 
LVL 5

Accepted Solution

by:
si_shamil earned 2000 total points
ID: 22643769
Here you go:
Const UAC_ENABLE = 1
Const UAC_DISABLE = 0
Const UAC_REGKEY = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA"
 
If Wscript.Arguments.Count <> 1 Then
    Wscript.Echo "Usage: " & Wscript.ScriptName & " Enable|Disable|Status"
    Wscript.Quit
End If
 
Set Shell = CreateObject( "WScript.Shell" )
 
If UCase(Wscript.Arguments.Item(0)) = "ENABLE" Then
    Shell.RegWrite UAC_REGKEY, UAC_ENABLE, "REG_DWORD"
    Wscript.Echo "UAC Enabled, please reboot..."
    Wscript.Quit
End If
 
If UCase(Wscript.Arguments.Item(0)) = "DISABLE" Then
    Shell.RegWrite UAC_REGKEY, UAC_DISABLE, "REG_DWORD"
    Wscript.Echo "UAC Disabled, please reboot..."
    Wscript.Quit
End If
 
If UCase(Wscript.Arguments.Item(0)) = "STATUS" Then
    If Shell.RegRead(UAC_REGKEY) = 0 Then
        Wscript.Echo "UAC is Disabled."
    Else
        Wscript.Echo "UAC is Enabled."
    End If
        Wscript.Quit
End If

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:ankur3020
ID: 22652280
i tested the code whenever i ran it , just a message display "Enable/Disable/Status" nothing else.

do you want me to create a dword with name enable LUA and assign it value 0 for disable and 1 for enable UAC.

otherwise please explain the above code
0
 
LVL 5

Assisted Solution

by:si_shamil
si_shamil earned 2000 total points
ID: 22652448
The above script must be run form command line:

For example to disable UAC run form command line: "cscript UAC.vbs disable"
The UAC.vbs may be different in your case, depending of the name you gave to the script"

If you want just to disable UAC use this code:
Const UAC_DISABLE = 0
Const UAC_REGKEY = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA"
 
Set Shell = CreateObject( "WScript.Shell" )
Shell.RegWrite UAC_REGKEY, UAC_DISABLE, "REG_DWORD"
Wscript.Echo "UAC Disabled, please reboot..."

Open in new window

0
 

Author Comment

by:ankur3020
ID: 22661028
can i run the above code with vbs for disabling uac.?
0
 
LVL 5

Expert Comment

by:si_shamil
ID: 22661510
Yes the last snippet will disable the UAC.
You will have to restart the computer after you run the script for changes to take effect.
0
 

Author Comment

by:ankur3020
ID: 22661812
following code is ok for enabling uac?
Const UAC_ENABLE = 1
Const UAC_REGKEY = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA"
 
Set Shell = CreateObject( "WScript.Shell" )
Shell.RegWrite UAC_REGKEY, UAC_ENABLE, "REG_DWORD"
Wscript.Echo "UAC enabled, please reboot..."

Open in new window

0
 
LVL 5

Expert Comment

by:si_shamil
ID: 22662422
yes it is!
0
 

Author Comment

by:ankur3020
ID: 22675866
dear when uac is turned on , i tried to run uac turning off script i.e. vbs file . it gave message permission denied. then how will it turn off uac when system do not allow to run file.
0
 
LVL 5

Expert Comment

by:si_shamil
ID: 22676783
You have to run this script as administrator, only with administrative permissions you can disable/enable UAC for all users
0
 

Author Comment

by:ankur3020
ID: 22694785
i tried to change registry value with uac enable, but still getting same error of permission denied. u pls check at ur side and then guide.

u know if u have uac enabled , and u try to open regedit with run it ask for permission, then how could vbs be allowed to change registry without permission. i think some code need to be added.
0
 

Author Comment

by:ankur3020
ID: 22738771
dear, i got alternative to solve this problem.

i do not require solution of this query. thanks for help.
0
 

Author Closing Comment

by:ankur3020
ID: 31507073
thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question