Highlight a phrase and click this icon to search it on Swyx-Forum    Highlight a phrase and click this icon to search it within the Swyx Knowledgebase    Highlight a phrase and click this icon to search it using Goolge    Highlight a phrase and click this icon to search it using Wikipedia

List of Blogs
Search Blogs

Blog Archive

Most recent blog entries

 

Jun25

Written by:Martin
25.06.2011 21:03 

Windows PowerShell is secure by default. It won’t execute a script when you double-click it. It won’t even run scripts per default when you told it to. You should understand this aspect of PowerShell’s security because it might bite you when you’re not expecting it Smile

If you download the SwyxWare PowerShell module with a modern web browser like Internet Explorer or Google Chrome, the file gets marked as originating from the internet. Windows even propagates this mark to unzipped files, if the zip file is marked. You can easily detect such files by opening the file properties:

image

Windows PowerShell recognizes this, too. Depending on PowerShell’s execution policy, such files might not be executed. Per default  this policy is set to “Restricted”, i.e. no scripts can be executed at all. In most cases “RemoteSigned” is a reasonable setting. It runs everything stored locally, but requires digital signatures on remote files, e.g. script files located on a network share. Files you download as described above is considered as remote, too.

If you happen to use the PowerShell Community Extension, a highly recommended module every serious PowerShell user should use, you can easily see if a file has been downloaded from the internet and is considered as remote by executing:

ls | Test-AlternateDataStream -Name Zone.Identifier -verbose

To unblock file you can use

ls | Unblock-File

For details about PowerShell’s execution policy use

get-help about_Execution_Policies

 

 

 

P.S. We’re thinking about running the SwyxWare PowerShell module build through our build server to get all files properly signed. With signed files and execution policy “remotesigned” you’d get this when you try importing the PowerShell module:

image

If you answer A for “Always run” here, PowerShell would trust all script files signed with the same Swyx code signing certificate and the “downloaded from internet” mark does no longer matter. It does this by adding the certificate to your trusted publishers list:

image

More information about digitally signing PowerShell script files is available via this command:

get-help about_signing

 

 

Tags:

 


Your name:
Your email:
(Optional) Email used only to show Gravatar.
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
Blog Help
Sponsors