Auto run of PS Script

This topic contains 3 replies, has 3 voices, and was last updated by  Joel Sallow 3 months, 1 week ago.

  • Author
    Posts
  • #98283

    Sankhadip Roy
    Participant

    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.

  • #98284

    Olaf Soyk
    Participant

    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"
  • #98902

    Joel Sallow
    Participant

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

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser 

You must be logged in to reply to this topic.