Author Posts

April 9, 2018 at 5:09 am

Hi Team,
Need an assistance for auto executing PowerShell script (ps1). I know that for security reason PS scripts are not run automatically, but yet if you find any way out please guide me.
I tried using batch file, but it's failed actually. The batch file opening the prompt of PowerShell but after that nothing executed. I'm planning for creating a schedule task, but yet feeling that will not work.
So if any of you find any tricks for the same, please let me know.
Thanks in Advance.
Regards,
Roy.

April 9, 2018 at 7:54 am

That's actually not a Powershell scripting issue. 😉 To run a Powershell script you should use a proper command line:

Powershell.exe -ExecutionPolicy Bypass -NoProfile -File "\.ps1"

April 16, 2018 at 2:57 am

Thanks, it works.

April 16, 2018 at 3:45 am

Alternately, you can elect to change the execution policy to permit scripts to run.

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser