Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bypass UAC in VbScript

Tags:

uac

vbscript

I have a Vbscript that runs on user log off that is suppose to turn off a service, however i't can't turn off the service since it's being blocked by UAC. I was wondering if there is a way to bypass UAC in my vbscript instead of having to turn off UAC on every machine in my domain. thanks!

like image 355
Kaustix Avatar asked Jan 28 '26 16:01

Kaustix


1 Answers

What would be the point of UAC if you could bypass it by saying "it shouldn't apply to me"? You cannot bypass it from vbscript.

You can do this administratively though, by running the script using elevated credentials in the first place.

For example by having an "on logon" scheduled task, running as Administrator or SYSTEM. I believe this works in Windows 7, and vista.

To create such a task on a remote machine:

schtasks.exe /create /S COMPUTERNAME /RU "NT AUTHORITY\SYSTEM" /RL HIGHEST /SC ONLOGON /TN "Administrative OnLogon Script" /TR "cscript.exe \"Path\To\Script.vbs\""

Tasks can also be created using script.

Note: If this is the only thing the script does, you can simply use a command like SC or NET STOP to stop the service directly.

like image 174
Ben Avatar answered Feb 01 '26 12:02

Ben



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!