Author Posts

August 15, 2014 at 1:39 pm

Hello!

Working hard to learn Powershell and could use some help.

Trying to set up a Powershell FTP Client I found here:

http://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb/

Module is in the right place (as far as I know)

[blockquote]%USERPROFILE%\Documents\WindowsPowerShell\Modules
%WINDIR%\System32\WindowsPowerShell\v1.0\Modules[/blockquote]

I run the Cmdlet

[blockquote]Import-Module -name "PSFTP"[/blockquote]

And get this error

[blockquote]Import-Module : Errors occurred while loading the format data file:
C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml, , C:\Users\Dell
T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml: The file was skipped because of the following validation
exception: File C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml cannot be loaded. The file
C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml is not digitally signed. You cannot run this script
on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170..[/blockquote]

I read the Execution Policies page here

http://technet.microsoft.com/library/hh847748.aspx

That says to run Unblock-File if my Execution Policy is RemoteSigned, which it is.

[blockquote]Unblock-File -Path "C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml"[/blockquote]

I run this without error

But when I run the same Import-Module Cmdlet I still get the same error.

[blockquote]Import-Module : Errors occurred while loading the format data file:
C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml, , C:\Users\Dell
T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml: The file was skipped because of the following validation
exception: File C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml cannot be loaded. The file
C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml is not digitally signed. You cannot run this script
on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170..[/blockquote]

Any ideas?

Thanks!

August 15, 2014 at 1:55 pm

Are you using PowerShell 3.0 or later? If so, you can quickly tell whether that file is still blocked by running this command:

Get-Content -Path 'C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml' -Stream Zone.Identifier

If you get an error that says it couldn't open the alternate data stream Zone.Identifier, then the file is not blocked. If it says:

[ZoneTransfer]
ZoneId=3

then the file is, indeed, still blocked for some reason. You could try this command to unblock it, though this should be doing exactly the same thing as Unblock-File, and may fail for the same reason (whatever that reason happens to be):

Remove-Item -Path 'C:\Users\Dell T7400\Documents\WindowsPowerShell\Modules\PSFTP\PSFTP.Format.ps1xml' -Stream Zone.Identifier

September 25, 2014 at 12:48 pm

Thanks for your response!

I ran the first command and got the "couldn't open the alternate..." response to it's apparently not blocked. But when I try and use a cmdlet that the module author specifies like "Set-FTPConnection" I get the error:

"The term 'Set-FTPConnection' is not recognized as the name of a cmdlet"

Thanks for you help!

February 7, 2015 at 5:06 am

I've found the same issue while preparing for a PowerShell demo

it really looks like PowerShell is caching the info.

When I try to run a file, get the 'digitally signed' error, then unblock the file.
Still I cannot immediately run the unblocked file.

The file IS unblocked.
If I start a new powershell shell, the file can run..
it looks as if the first failed run is cached in the powershell session, would like to know how to clear that.

till then, the workaround is : start a new shell

December 7, 2016 at 4:55 pm

Apparently that happens when we download zip (compressed) files containing several files. We would run Unblock-File against one of those (usually the .ps1), but when that references other files (and other .ps1) the same error shows up.

Quick solution is to unblock the zip file after downloading it and only then uncompress it. The uncompressed files will all be unblocked.