About 48,400 results
Open links in new tab
  1. How to enable execution of PowerShell scripts? - Super User

    When I try to execute my PowerShell script I get this error: File C:\\Common\\Scripts\\hello.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help

  2. Run PowerShell script as a different user and elevated

    Jan 21, 2021 · Then execute the script elevated from that local copy instead. Execute the Start-Process Powershell a little differently than you were executing it for it to take the action of the script logic while running elevated too. Add the ExecutionPolicy Bypass -NoProfile -File parameters and run the script after that for it to work.

  3. how to run a powershell script as administrator - Super User

    Feb 12, 2010 · Create a shortcut to your Powershell script on your desktop; Right-click the shortcut and click Properties; Click the Shortcut tab; In the Target: section, make sure you specify powershell.exe -f before your script path. This will enable Run as Administrator option in the Advanced... Tab. Click Apply; Click Advanced; Select Run as Administrator

  4. powershell - How to execute a .ps1 from another .ps1 file

    Feb 24, 2015 · I have two PowerShell files. a.ps1 and b.ps1. At a center point in a.ps1 I want to start executing code in b.ps1 and terminate a.ps1 script. How to do it considering that both files are located in the same folder?

  5. How to Execute Powershell Script AS Powershell 7 from Command …

    May 28, 2020 · When I run that same .PS1 script from command prompt using powershell testscript_writefile.ps1, I get: Name Value ---- ----- PSVersion 5.1.14393.3471 PSEdition Desktop How can I execute a Powershell script AS Powershell 7 instead of Powershell 5?

  6. What is the ampersand sign (&) before commands in PowerShell?

    Feb 9, 2023 · You can use the call operator to execute scripts using their filenames. The example below shows a script filename that contains spaces. When you try to execute the script, PowerShell instead displays the contents of the quoted string containing the filename. The call operator allows you to execute the contents of the string containing the filename.

  7. How to run a PowerShell command silently? - Super User

    Jun 14, 2018 · It runs successfully, but pops up the powershell window, no matter what. The other answer to run the utility "Runhidden.exe" in front of the command to run the script simply could not find the file, no matter the path or environment variables I applied.

  8. Equivalent of bash's `source` command in Powershell?

    To run a bash script line-by-line (so as to preserve environment variables, for instance), one does the following: $ . myscript.sh Or: $ source myscript.sh I have a PowerShell script that - among other things - sets the value of the prompt via function called prompt. Simply running this script (".\myscript.ps1") does not change the prompt.

  9. Run Powershell with parameters from batch file - Super User

    Mar 2, 2021 · I solved creating a script , .ps1 file , in Powershell ISE and after this I went to Powershell window and type this command to allow script to run : Set-ExecutionPolicy RemoteSigned and create a .bat file with this line : Powershell.exe -executionpolicy remotesigned -File "ps1_file_path\ps1_file_name.ps1" and all works fine.

  10. How can I run psd1 and psm1 files in powershell? - Super User

    Aug 28, 2020 · Local scripts or anything you run in your current session will work the way you are doing it. So, this not really a workaround, for PS, it's an 'I want to run my PowerShell stuff regardless of what the host EP is set for'. You have to be willing to take complete responsibility for doing that. For if you mess something up, well, you know...

Refresh