Page 1 of 1

ActivePoSh and Exchange 2007 shell

Posted: Tue Oct 04, 2011 12:32 pm
by hitec92407
Primalscript 2011, ActiveXPosh, Vista 64-Bit, Exchange 2007 EMS
I'm having trouble with the following code.

CreateActiveXPoshActiveXPosh.Execute("Get-Mailbox user01")
Function CreateActiveXPosh() Dim success ' Create the PowerShell connector object Set ActiveXPosh = CreateObject("SAPIEN.ActiveXPoSH") success = ActiveXPosh.Init(vbFalse) 'Do not load profiles ActiveXPosh.Execute("Add-PSSnapIn Microsoft.Exchange.Management.PowerShell.Admin") If success <> 0 Then MsgBox "Init failed" End If If ActiveXPosh.IsPowerShellInstalled Then MsgBox "Ready to run PowerShell commands" Else MsgBox "PowerShell not installed" End If 'Set the output mode ActiveXPosh.OutputMode = OUTPUT_CONSOLEEnd Function

When I run the code, it fails with the following error:

ERROR: Add-PSSnapin : No Windows PowerShell Snap-ins are available for version 1.ERROR: At line:1 char:13ERROR: + Add-PSSnapIn <<<< Microsoft.Exchange.Management.PowerShell.AdminERROR: The term 'Get-Mailbox' is not recognized as a cmdlet, function, operable prograERROR: m, or script file. Verify the term and try again.ERROR: At line:1 char:12ERROR: + Get-Mailbox <<<< user01Exit code: 0 , 0000h
But if I run Powershell from "Tools->Powershell..." menu and add the snapin,
the get-mailbox command succeeds.

Can anyone help?

ActivePoSh and Exchange 2007 shell

Posted: Tue Oct 04, 2011 12:44 pm
by Alexander Riedel
It's been a while that I looked at ActiveXPosh. Maybe it is still compiled against PowerShell 1.
I'll double check as soon as I get to it