#207243 - 2013-05-02 01:22 PM
Disable UAC via Registry with login script Error 5 access denied
|
KidLark
Just in Town
Registered: 2011-10-20
Posts: 3
Loc: Germany
|
Hi Group,
OS Windows 7 64bit User login on, is local admin for an installation, which should be started by means of the login script, the UAC Settings should be disabled.
To achive this, it should be possible to deactivate uac through changing a registry key.
The user, beeing local admin, can change the registry manualy.
I use following code:
$Key=("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System") $Val=("EnableLUA") $Type=("REG_DWORD") $Entry = ReadValue($Key,$Val) ? $Entry IF $Entry = 1 $NewEntry= 0 WriteValue($Key, "$Val", $NewEntry, $Type) ? ''+@ERROR+' - '+@SERROR if @error = 0 ? "Value written" else ? "Value not written!" endif
--------------
? ''+@ERROR+' - '+@SERROR gives message "5 - acces denied"
It doesn't matter wether to UAC is only disabled after reboot. Users log on often and I can check the settings everytime the users log in. After installation I want to switch UAC on again
Help is very welcome!
Best Regards Georg
Edited by KidLark (2013-05-02 01:25 PM)
|
|
Top
|
|
|
|
#207249 - 2013-05-02 05:44 PM
Re: Disable UAC via Registry with login script Error 5 access denied
[Re: Lonkero]
|
KidLark
Just in Town
Registered: 2011-10-20
Posts: 3
Loc: Germany
|
ok, i can see your point.
but would there be a way to change the registry key, even though it is not recommended?
regards
Georg
|
|
Top
|
|
|
|
#207252 - 2013-05-02 09:11 PM
Re: Disable UAC via Registry with login script Error 5 access denied
[Re: Arend_]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
|
|
Top
|
|
|
|
#207256 - 2013-05-03 05:02 AM
Re: Disable UAC via Registry with login script Error 5 access denied
[Re: Arend_]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
There are also a number of errors in the code you posted. Extra ()'s for example, and a missing Endif.
$Key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
$Val="EnableLUA"
$Type="REG_DWORD"
$Entry = ReadValue($Key,$Val)
? $Entry
IF $Entry = 1
$NewEntry= 0
$nul = WriteValue($Key, $Val, $NewEntry, $Type)
? ''+@ERROR+' - '+@SERROR
If @error = 0
? "Value written"
Else
? "Value not written!"
Endif
Endif
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
|