General Info and Getting Started
By default the "Execution Policy" is very restrictive, and you can't run your own .ps1 files (or do anything else)! To change this, open powershell and use this command. When prompted, type "Y" and hit enter.
- relax default script execution policy:
Import a module Assuming you've navigated to the folder where the .psm1 file lives:
Download modules List of popular modules: http://social.technet.microsoft.com/wiki/contents/articles/4308.popular-powershell-modules.aspx
Run a script
To run a script from the CMD shell:
powershell -file "c:\batch\demo.ps1"
To run a script file, from the Powershell console, use one of these methods:
PS C:\> & "C:\Belfry\My first Script.ps1" PS C:\> C:\Belfry\Myscript.ps1 (if script path has no spaces) PS C:\> .\Myscript.ps1 (if script is in current directory)
WSUS Administration with Powershell
First Import the WSUS admin module.
- The older version is PoshWSUS 1.1 . There's a newer one that might use different commands. The following assumes you're using ver 1.1.
Then connect to database
connect-wsusserver -wsusserver "MCSWSUS" -port "8530"
- Basic Guide and commands: http://learn-powershell.net/2010/11/14/wsus-administrator-module/