Click here to Skip to main content
14,456,165 members
Rate this:
Please Sign up or sign in to vote.
See more:
I need someone to help me correct the script below to bypass UAC Consent and execute without prompt?
If Not WScript.Arguments.Named.Exists("elevate") Then
  CreateObject("Shell.Application").ShellExecute WScript.FullName _
    , """" & WScript.ScriptFullName & """ /elevate", "", "runas", 1
  WScript.Quit
End If


What I have tried:

If Not WScript.Arguments.Named.Exists("elevate") Then
  CreateObject("Shell.Application").ShellExecute WScript.FullName _
    , """" & WScript.ScriptFullName & """ /elevate", "", "runas", 0
  WScript.Quit
End If
Posted
Updated 14-Feb-20 14:07pm
Rate this:
Please Sign up or sign in to vote.

Solution 1

You can't bypass UAC - that's the whole point!
If you could bypass UAC then two things would happen:
1) Users wouldn't know that what an app is about to do is potentially dangerous and / or damaging to their system.
2) If you could do it, so could I. And him over there, with the "I write Ransomware" T-shirt. And suddenly, the malware problem takes a whole new prominence and nobodies computers are safe, even if you do exercise proper precautions.

So no - you can't do it. Elevation requires UAC confirmation from the user and cannot be bypassed.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Quote:
By pass windows UAC consent.

UAC is specially designed to make life of malware programmers harder.
malware is anything not legitimate.
If your software is legitimate, why is it a problem yo ask the user for permission with UAC.
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

Alright, thanks for you contribution.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100