Monday, June 27, 2011

How to run a PowerShell script ?

powershell.exe -File C:\my_path\yada_yada\run_import_script.ps1
-or-
powershell.exe -noexit "& 'c:\Data\ScheduledScripts\ShutdownVM.ps1'"

Note: use absolute path and no relative path.

If you are running from inside PowerShell environment then
navigate to the directory where the script lives
PS> cd C:\my_path\yada_yada\ (enter)Execute the script:
PS> .\run_import_script.ps1 (enter)

No comments: