This module allows you to execute scripts under the current user while running as SYSTEM using impersonation.

Minimum PowerShell version


Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name RunAsUser

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More


Kelvin Tegelaar -


(c) 2020 Kelvin Tegelaar - All rights reserved.



RMM Invoke-AsCurrentUser CyberDrain




This module has no dependencies.

Release Notes

Version 1.0 allows you to run scripts as the current user. Version 1.5 has had a near-complete rewrite of the C# code, adding functionality to support elevated sessions. 1.5.1 added support for waiting for a process to finish. 1.6 added the "UseWindowsPowerShell" switch, to enforce the usage of windows PowerShell. Version 1.8 introduce the parameter -NonElevatedSession to create sessions without admin token. Version 1.9 introduced the option to have a visble PowerShell window.

Version History

Version Downloads Last updated
2.2 (current version) 14,044,082 3/8/2021
2.1 168 3/8/2021
2.0 164,246 3/5/2021
1.9 2,292,330 10/13/2020
1.8 30,514 8/28/2020
1.6 14,724 8/4/2020
1.5.1 34,241 7/22/2020
1.5.0 3,473 7/16/2020
1.0.2 211 7/14/2020
1.0.1 579 7/14/2020
1.0 11 7/13/2020