Loading PoshWSUS via profile

Aug 8, 2012 at 2:43 PM
Edited Aug 8, 2012 at 2:46 PM

Hi, I am wondering what the best way to automatically load the PoshWSUS module is?

If I enter the following line into my profile:

import-module PoshWSUS

It works but, it then gives me a challlenge for each Cmdlet as follows:

Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your computer. Do you want to run
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PoshWSUS\PoshWSUS.psm1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"):r

THEN:

Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your computer. Do you want to run
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PoshWSUS\Scripts\Add-WSUSClientToGroup.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"):

Is there a way around having to answer each challenge manually?

OR is there a setting I need to change so that this challenge-by-challenge doesn't occur?

Coordinator
Aug 10, 2012 at 7:16 PM

Hi Lahru,

This is happening because of how PowerShell's execution policy handles downloaded scripts from the internet. Fortuantly, there are a couple of ways to get around this. On the .zip file that you downloaded (it is better to do this on the .zip file instead of each file within the .zip), you can open up the properties (assuming you are on Vista or above OS) and click the buton at the bottom that says 'Unblock'. If that is not available for one reason or the other, from the PowerShell prompt, navigate to the .zip file and run the following command:

notepad <nameofzipfile.zip:Zone.Identifier

It should open up notepad with something like the following in it:

[ZoneTransfer]
ZoneId=3

Delete all of the data and save the file. Now go back and unzip the file to where ever you are saving the module to. Now when you load up the module, you won't have those annoying messages to work through.

Sep 7, 2012 at 2:49 PM

Hello,

it may be easier just to delete the stream, with:

del <nameofzipfile>:Zone.Identifier

Bye, Claudio