About 304,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 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

  3. How to run a PowerShell script from a batch file

    To convert a single PowerShell script, simply run this: Get-ChildItem -Path <FILE-PATH> | Convert-PowerShellToBatch Where is the path to the desired file. The converted files are located in the source directory. i.e., <FILE-PATH> or <DIR-PATH>. Putting it all together: create a .ps1 file (PowerShell script) with the following code in it:

  4. Call PowerShell script PS1 from another PS1 script inside …

    Mar 28, 2018 · Similarly, I can run my custom scripts by just putting the name of the script in the script-block ::sid.ps1 is a PS script I made to find the SID of any user ::it takes one argument, that argument would be the username echo $(sid.ps1 jowers) (returns something like)> S-X-X-XXXXXXXX-XXXXXXXXXX-XXX-XXXX $(sid.ps1 jowers).Replace("S","X") (returns ...

  5. How to run a PowerShell script without displaying a window?

    Jan 28, 2015 · Make a vbs script to run a hidden batch file which launches the powershell script. Seems silly to make 3 files for this task but atleast the total size is less than 2KB and it runs perfect from tasker or manually (you dont see anything). scriptName.vbs

  6. In PowerShell, how do I define a function in a file and call it from ...

    May 16, 2011 · In that folder, create a folder named MyFunctions, and place the MyFunctions.psm1 file into it (the module file must reside in a folder with exactly the same name as the PSM1 file). Once that is done, open PowerShell, and run this command: Get-Module …

  7. How to run a Powershell script from the command line and pass a ...

    Dec 5, 2012 · The term '.\Foo.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. EDIT: Wasn't working because PowerShell was changing directory due to profile.ps1 containing cd C:\

  8. Windows Powershell policy execution bypass - Stack Overflow

    Apr 26, 2021 · Run a Single Script with the Bypass Policy. If you need to execute an unsigned script that doesn’t adhere to the current session's execution policy, use the following command: powershell.exe -ExecutionPolicy Bypass -File C:\Path\To\YourScript.ps1. Script shorthand: powershell -ep Bypass C:\Path\To\YourScript.ps1

  9. How to pass command-line arguments to a PowerShell ps1 file

    Aug 18, 2009 · File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script file path followed by the script parameters. i.e. powershell.exe -File "C:\myfile.ps1" arg1 arg2 arg3 means run the file myfile.ps1 and arg1 arg2 & arg3 are the parameters for the PowerShell script.

  10. Run a PowerShell script from a cmd batch as admin

    Jan 17, 2022 · I have a PowerShell setup which I want to execute on a computer where perhaps the execution policy is restricted and requires admin rights. Ideally, I could wrap it in a cmd batch like follows: powershell -Command "Start-Process powershell -Verb runAs -ArgumentList '-noexit','-ExecutionPolicy','bypass','-File','C:\path\setup.ps1'"

Refresh