Startup errors

Nov 15, 2012 at 8:24 PM
Edited Nov 15, 2012 at 8:25 PM

Hi all, I get the following errors when loading PowerTab:

Exception calling "LoadFile" with "1" argument(s): "An attempt was made to load an assembly from a network location which would have caused the
assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so
this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See
http://go.microsoft.com/fwlink/?LinkId=155569 for more information."
At C:\Users\tburrell\Documents\WindowsPowerShell\Modules\PowerTab\PowerTab.psm1:10 char:5
+     [Void][System.Reflection.Assembly]::LoadFile((Join-Path $PSScriptRoot "Share ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException

Get-Content : Cannot find path 'Function:\TabExpansion' because it does not exist.
At C:\Users\tburrell\Documents\WindowsPowerShell\Modules\PowerTab\PowerTab.psm1:17 char:20
+ $OldTabExpansion = Get-Content Function:TabExpansion
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Function:\TabExpansion:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Import-Module : Could not load file or assembly 'file:///C:\Users\tburrell\Documents\WindowsPowerShell\Modules\PowerTab\Lerch.PowerShell.dll' or
one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At C:\Users\tburrell\Documents\WindowsPowerShell\Modules\PowerTab\PowerTab.psm1:56 char:1
+ Import-Module (Join-Path $PSScriptRoot "Lerch.PowerShell.dll")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

Does anyone know how I can resolve these?

Anyone else seeing the same? I am running Windows 8 (Powershell 3).

Thanks!

Jan 14, 2013 at 1:22 PM
Edited Jan 14, 2013 at 1:46 PM

Change string "TabExpansion" to "TabExpansion2" (simply add 2) in file "PowerTab.psm1" at line 17 and line 20 (1st occurence). Then it works with PowerShell 3.

I don't have Windows 8, but under Windows 7 it works after these changes.

Coordinator
Apr 23, 2013 at 10:56 PM
I have a code fix for the second error that will be in the next release.

The other two errors are probably due to you not unblocking the PowerTab files.
Oct 7, 2013 at 8:23 AM
It's been nearly a year... PowerTab is still not updated with a fix? It took me a while before I realized it wasn't me that was doing something wrong. Luckily, this page is searchable on google.com
Dec 18, 2013 at 3:49 AM
Ok I am using PS version 2 and jo2k's fix indeed works! Just follow the instructions precisely. I noticed this error does not surface after installing PT on many many hosts also having PS version 2. Only a handful of hosts encountered the error. Regardless, the fix worked on Windows Server 2008 R2. I did not see this error on Windows 7.

The exact error I encountered on Windows Server 2008 R2:

Get-Content : Cannot find path 'Function:\TabExpansion' because it does not exist.
At C:\Users\tsmith\Documents\WindowsPowerShell\Modules\PowerTab\PowerTab.psm1:17 char:20
  • $OldTabExpansion = Get-Content Function:TabExpansion
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Function:\TabExpansion:String) [Get-Content], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand