Skip to content

Latest commit

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Description

Check if current session is elevated, if not restart process using -RunAs.

Instructions

Place the following code at the top of your script, making sure "Invoke-ElevateScript.ps1" is within the same directory:

.$PSScriptRoot\Invoke-ElevateScript.ps1Invoke-ElevateScript

Notes

Limitations

Invoke-ElevateScript only works on saved scripts.

Alternative Consoles

Running the function will always start a native PowerShell process (if not yet elevated), even if it was launched using an alternative console like cmder.

About

PowerShell - Check if current session is elevated, if not restart process using -RunAs.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages