November 26, 2013 at 2:38 pm #11685
Is there any way to use import-module without a prompt to load modules from a profile at PowerShell start? I don't see a -quiet switch for the cmdlet.
November 26, 2013 at 2:53 pm #11686
It's probably your execution policy. Import-Module doesn't generate a prompt per se. But the right combination of module and execution policy can certainly generate prompts.
What's (a) the prompt you're seeing and (b) your execution policy?
November 26, 2013 at 2:59 pm #11687
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:\Users\Jolson\Documents\WindowsPowerShell\Modules\dnsshell\DnsShell.Format.ps1xml?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
PS C:\Users\Jolson> Get-ExecutionPolicy
November 26, 2013 at 3:04 pm #11688
The module is a script module, which puts it under control of your execution policy. Even under "Unrestricted," the shell prompts (by default) for scripts coming from a remote location, or scripts you downloaded from the Internet (Outlook and IE both flip a bit in the file header). Option 1, flip the bit so the file doesn't look like it came from the Internet (see http://www.howtogeek.com/70012/what-causes-the-file-downloaded-from-the-internet-warning-and-how-can-i-easily-remove-it/).
Alternately, you can use the Bypass execution policy (see http://blogs.technet.com/b/christwe/archive/2012/09/21/but-i-ran-set-executionpolicy-unrestricted-what-is-going-on.aspx).
See http://blogs.msdn.com/b/powershell/archive/2007/05/06/running-scripts-downloaded-from-the-internet.aspx for background information. The behavior is also documented in the Set-ExecutionPolicy cmdlet's help, I believe.
November 26, 2013 at 4:59 pm #11690
Thanks, removing the Zone.Identifier information allows it to load. I used the Sysinternals tool, but wondering if it could have been done in Powershell came across this Stack Overflow post:
There's an unblock-file cmdlet in PowerShell v3, but overwriting the stream info with
cmd /c "echo.>test.exe:Zone.Identifier"would be a way to do this without leaving the shell.
You must be logged in to reply to this topic.