About 306,000 results
Open links in new tab
  1. windows - How to run a PowerShell script - Stack Overflow

    Or: you can run the PowerShell script from the Command Prompt (cmd.exe) like this: powershell -noexit "& ""C:\my_path\yada_yada\run_import_script.ps1""" (enter) according to Invoking a PowerShell script from cmd.exe (or Start | Run) by Kirk Munro. Or you could even run your PowerShell script asynchronously from your C# application.

  2. How to enable execution of PowerShell scripts? - Super User

    Feb 8, 2010 · Type the following command to allow scripts to run and press Enter: Set-ExecutionPolicy RemoteSigned Type A and press Enter (if applicable). Type the following command to run the script and press Enter: & "C:\PATH\TO\SCRIPT\first_script.ps1" In the above command, make sure to change "PATH\TO\SCRIPT" to the location of your script.

  3. Why are my PowerShell scripts not running? - Stack Overflow

    Aug 14, 2008 · 2) If you want scripts to simply run, setting the execution policy is probably still the way to go, and possibly unrelated to OP: 3) it seems the best policy is for startup scripts, specify the execution policy and scope in the command line running the script, and for logon set the session configuration as needed.

  4. powershell - How to fix "running scripts is disabled on this system ...

    Nov 1, 2020 · In powershell # To check the current execution policy, use the following command: Get-ExecutionPolicy # To change the execution policy to Unrestricted, which allows running any script without digital signatures, use the following command: Set-ExecutionPolicy Unrestricted # This solution worked for me, but be careful of the security risks involved.

  5. Windows Powershell policy execution bypass - Stack Overflow

    Apr 26, 2021 · To temporarily bypass the execution policy and run a PowerShell script, do either of the following: Temporarily set the Bypass Execution Policy. This will set the execution policy to “Bypass” for the current user during the session, allowing you to run multiple scripts without restrictions in the current session.

  6. How to run powershell script from .ps1 file? - Stack Overflow

    Oct 23, 2019 · There are several ways to run a .ps1 file. The simplest way is to right-click the file and choose 'Run with PowerShell'. As others have suggested, you can also run your .ps1 file using powershell.exe either in command prompt or from a BATCH or CMD file. As follows: powershell.exe -File C:\Script.ps1

  7. Set up PowerShell Script for Automatic Execution

    Aug 27, 2008 · With this method however, you will first need to set your execution policy to allow scripts to be ran. You only need to do this once per PC and it can be done by running this line in a PowerShell command prompt. Start-Process PowerShell -ArgumentList 'Set-ExecutionPolicy RemoteSigned -Force' -Verb RunAs

  8. Running CMD command in PowerShell - Stack Overflow

    One solution would be to pipe your command from PowerShell to CMD. Running the following command will pipe the notepad.exe command over to CMD, which will then open the Notepad application. PS C:\> "notepad.exe" | cmd. Once the command has run in CMD, you will be returned to a PowerShell prompt, and can continue running your PowerShell script.

  9. Run Powershell script when you open Powershell - Super User

    Mar 8, 2015 · A file Microsoft.PowerShell_profile.ps1 will be created in C:\Users\<username>\Documents\WindowsPowerShell\ for PowerShell 5 and older or C:\Users\<username>\Documents\PowerShell\ for PowerShell 6 Core (this folder will be automatically created).

  10. Running a command as Administrator using PowerShell?

    Sep 12, 2016 · Elevated PowerShell from Start>Run. You cannot run elevated powershell from the "run" command, in 2012R2 or 2016, without shelling twice: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell -Command "saps PowerShell …