|
Post by ZF on Apr 28, 2015 3:20:35 GMT -5
Create a batch file with the following content to run as administrator: @echo OFF SET ThisScriptsDirectory=%~dp0 SET PowerShellScriptPath=%ThisScriptsDirectory%MyPowerShellScript.ps1 PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%PowerShellScriptPath%""' -Verb RunAs}"; To import and run the commands within the imported powershell script: PowerShell -NoProfile -ExecutionPolicy Bypass -Command "import-module '%PowerShellScriptPath%'; <command>"; SOURCE: blog.danskingdom.com/allow-others-to-run-your-powershell-scripts-from-a-batch-file-they-will-love-you-for-it/
|
|