Travel

Categories

Run Windows PowerShell script

1. Name the script as .ps1

2. Under Powershell, remember to set Set-ExecutionPolicy RemoteSigned or Set-ExecutionPolicy Unrestricted

3. To run the powershell script outside powershell :

powershell.exe -noexit c:\scripts\test.ps1
powershell.exe -noexit get-childitem c:\scripts

Call from vbscript
Set objShell = CreateObject(“Wscript.Shell”)
objShell.Run(“powershell.exe -noexit c:\scripts\test.ps1”)

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>