Page 1 of 1

Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Tue Aug 06, 2013 4:00 pm
by WintelRob
I have a Windows Server 2008 R2 system, where I've installed ActiveXPosh 64-bit.

My test script fails with this error:

S:\Scripting\example_using_ActiveXPosh_to_call_PowerShell.vbs(4, 2) ActiveXPoshV3: Could not load file or assembly 'System.Man
agement.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad3
64e35' or one of its dependencies. The system cannot find the file specified.


The first few lines of my test script:

Dim success
' Create the PowerShell connector object
Set ActiveXPosh = CreateObject("SAPIEN.ActiveXPoSHV3")
success = ActiveXPosh.Init(vbFalse) 'Do not load profiles
If success <> 0 then
WScript.Echo "Init failed"
end if
If ActiveXPosh.IsPowerShellInstalled Then
WScript.Echo "Ready to run PowerShell commands"
Else
WScript.Echo "PowerShell not installed"
End If


I've done the command:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>RegAsm.exe "C:\Program Files\SAP
IEN Technologies, Inc\ActiveXPowerShell V3\ActiveXPoshV3.dll" /codebase
Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

Types registered successfully



Anyone have an idea as to why this won't work for me?

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Tue Aug 06, 2013 4:28 pm
by Alexander Riedel
From the error message it would appear you don't have PowerShell V3 installed. Can you do a
$psversiontable
in a shell?

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Tue Aug 06, 2013 5:19 pm
by WintelRob
So this only works with v3?


Name Value
---- -----
CLRVersion 2.0.50727.5466
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Tue Aug 06, 2013 9:00 pm
by Alexander Riedel
Well, no, but you downloaded the V3 version.
Go to the downloads site and download the older
ActiveXPoshV2.zip
For 64 bit you will have to manually run the registration for the component.

And yes, I just updated the names to make it clear which version is for what :-)

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Mon Aug 12, 2013 5:11 pm
by WintelRob
Thanks. I couldn't see the difference until you made the name change.

I still can't run it. I've made sure that my .NET Framework v4 is good. I first uninstalled the V3 ActiveXPosh, and then I installed the V2. I get an error trying to run the script: "...can't create object: 'SAPIEN.ActiveXPoSH'".

I will have to try rebooting my workstation.

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Mon Aug 12, 2013 6:54 pm
by Alexander Riedel
The V2 version, just like Powershell V2, uses the .NET 2.0 runtime.
You need to run the V2 regasm tool against the dll.

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Mon Aug 19, 2013 5:05 pm
by WintelRob
On a Windows 2003 Standard 32-bit OS, with .NET Framework 2.0, I get this error (and I tried on two different systems):

C:\Install\ActiveXPoshV2>cscript ActiveXposhV2.vbs
C:\Install\ActiveXPoshV2\ActiveXposhV2.vbs(32, 2) ActiveXPosh: Could not load fi
le or assembly 'System.Management.Automation, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

(On a 64-bit OS with .NET Framework 4.0, I tried installing the ActiveXPoSH v2 DLL, and it didn't work, but the v3 DLL did work.)


I ultimately need to get this working on a 32-bit OS until such time as we can upgrade it to a newer 64-bit OS.

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Mon Aug 19, 2013 5:22 pm
by WintelRob
Sorry... I am having trouble keeping track of all of my different systems, in addition to my normal work... This server doesn't have PowerShell installed, so I am now installed PS v2 and then I will re-do the ActiveXPoSH install and registration.

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Mon Aug 19, 2013 5:25 pm
by WintelRob
OK, the v2 with PS v2 is working on a Windows Server 2003 32-bit system. I don't know why this wasn't working on my desktop system, but I will assume it has something to do with the fact that I have multiple versions of .NET Framework, including 2.0 and 4.0. I will ignore this and just continue working on the system where I got it working.

Thanks.

Is there any FAQ that has some examples of handling errors returned from calling a PowerShell script?

Re: Installed ActiveXPosh but it doesn't seem to be loaded

Posted: Mon Aug 19, 2013 5:46 pm
by Alexander Riedel
The dlls are compiled to be platform agnostic, they should register and run on 64 and 32 bit systems.
The V2 version needs the 2.0 runtime, just like PowerShell V2
The V3 version needs the 3.0 runtime, just like POwerShell V3

PowerShell error messages tend to be pretty messy and cryptic. Our PowerShell forum is usually a good spot to ask if you get an error message you can't decipher.