Page 1 of 1 1
Topic Options
#207243 - 2013-05-02 01:22 PM Disable UAC via Registry with login script Error 5 access denied
KidLark Offline
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
#207244 - 2013-05-02 02:10 PM Re: Disable UAC via Registry with login script Error 5 access denied [Re: KidLark]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
even if you get this to to work, turning UAC of like this would require a reboot, so you would need keep it of for weeks, and then when they finally reboot, turn it back on...

installing software in logon script is a big no+no. modifying system settings in user logon, big NO-NO.
_________________________
!

download KiXnet

Top
#207249 - 2013-05-02 05:44 PM Re: Disable UAC via Registry with login script Error 5 access denied [Re: Lonkero]
KidLark Offline
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
#207251 - 2013-05-02 09:10 PM Re: Disable UAC via Registry with login script Error 5 access denied [Re: KidLark]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Put it as Startup script, instead of logon script.
This is run under the "System" account, which has the privileges to make those changes.

Top
#207252 - 2013-05-02 09:11 PM Re: Disable UAC via Registry with login script Error 5 access denied [Re: Arend_]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Or just do it though GPO
Top
#207256 - 2013-05-03 05:02 AM Re: Disable UAC via Registry with login script Error 5 access denied [Re: Arend_]
ShaneEP Moderator Offline
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.

 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
   $nul = WriteValue($Key, $Val, $NewEntry, $Type)
   ? ''+@ERROR+' - '+@SERROR
   If @error = 0
      ? "Value written"
   Else
      ? "Value not written!"
   Endif
Endif

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Glenn Barnas) and 955 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.063 seconds in which 0.033 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org