AlphaVSS and PowerShell [Could not load file or assembly 'AlphaVSS.Win2008.x64...]

Nov 16, 2009 at 5:08 PM

I am trying to use AlphaVSS with Powershell v2.0 and when I go to instantiate an implementation:

$oFoo = [Alphaleonis.Win32.Vss.VssUtils]::LoadImplementation()

I get the following error:

Exception calling "LoadImplementation" with "0" argument(s): "Could not load file or assembly 'AlphaVSS.Win2008.x64, Version=1.0.9156.0, PublicKeyToken=3033cf2dbd31cad3' or one of its dependencies. The system cannot find the f
ile specified."
At C:\Users\David Bonnes\Documents\Personal -- Setups\db-server\Do-VSScopy.ps1:22 char:64
+     $foo = [Alphaleonis.Win32.Vss.VssUtils]::LoadImplementation <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

In full, my code is very simple, but I am now stuck (note the assemblies are also in the GAC)...

    Add-Type -path "C:\Users\...\Bin\AlphaVSS.Common.dll"      -ReferencedAssemblies Microsoft.VisualC
    Add-Type -path "C:\Users\...\Bin\AlphaVSS.Win2008.x64.dll" -ReferencedAssemblies Microsoft.VisualC

$psAppDomain = [AppDomain]::CurrentDomain; $psAppDomain.GetAssemblies()

    $foo = [Alphaleonis.Win32.Vss.OperatingSystemInfo]::OSVersionName           ; $foo
    $foo = [Alphaleonis.Win32.Vss.OperatingSystemInfo]::ProcessorArchitecture   ; $foo
    $foo = [Alphaleonis.Win32.Vss.VssUtils]::LoadImplementation()

So any advice would be appreciated!

FWIW, I refer to the following two discussions (which helped, but have not solved my problem):

 

Nov 16, 2009 at 5:19 PM

Also, this piece of code may be useful:

$psAppDomain = [AppDomain]::CurrentDomain
$psAppDomain.GetAssemblies()

as well as this one...

    $references = Get-ChildItem "C:\Users\...\Bin"      | % {
        $loaded  = [reflection.assembly]::LoadFile($_.FullName)
        $name    =$loaded.ManifestModule
        $loaded.GetReferencedAssemblies() | % {
            $toAdd='' | select Who,FullName,Name,Version
            $toAdd.Who,$toAdd.FullName,$toAdd.Name,$toAdd.Version = `
                $loaded,$_.FullName,$_.Name,$_.Version
            $toAdd
        }
}

$references | Group-Object FullName,Version | Select-Object -expand Name | Sort-Object