Running Powershell script with PSAD

Hello, I’m wondering if there is possibility to run *.ps1 file with PSAD. I can’t create exe file from ps1 because script content must be visible but simultaneously end users could start script without using console (I suppose that most of them even don’t know what it is). I thought about creating cmd file but there is a problem with non-Admin accounts and execution policy.
So to sum up - is there option to run custom ps1 without installing exe/msi file?

Something like this (no spell-checking):
Execute-Process -Path “$($envWinDir)\System32\WindowsPowerShell\v1.0\powershell.exe” -Parameters "-WindowStyle Hidden -File “$($DirFiles)\myscript.ps1"”

If you have a strict Execution Policy (i.e. RemoteSigned) this will have to downloaded and initiated locally on the target device. I believe that, due to the nature of them, it will also work fine with Group Policy Startup Scripts.

[Edit]:

And of course this forum’s wysiwyg editor messed up what’s inside the -File (go figure…).

The path to the script file should be within Double quotes, but since the -Parameter already is within double quotes you have to add a Grave accent before the quotes around the script file path (CTRL+F double qutes and grave accent on http://www.ascii-code.com )

1 Like