Auto run of PS Script

Welcome Forums General PowerShell Q&A Auto run of PS Script

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
1 year, 1 month ago.

  • Author
    Posts
  • #98283

    Participant
    Topics: 20
    Replies: 23
    Points: 107
    Rank: 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

    Participant
    Topics: 1
    Replies: 1330
    Points: 1,675
    Helping Hand
    Rank: Community Hero

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

      Participant
      Topics: 20
      Replies: 23
      Points: 107
      Rank: Participant

      Thanks, it works.

  • #98902

    Participant
    Topics: 2
    Replies: 435
    Points: 867
    Helping Hand
    Rank: Major Contributor

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

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser 

The topic ‘Auto run of PS Script’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort