ActivePoSh and Exchange 2007 shell

This forum can be browsed by the general public. Posting is no longer allowed as the product has been discontinued.
User avatar
Posts: 8
Joined: Tue Sep 13, 2011 6:39 am

ActivePoSh and Exchange 2007 shell

Post 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?

User avatar
Alexander Riedel
Posts: 7406
Joined: Tue May 29, 2007 4:43 pm

ActivePoSh and Exchange 2007 shell

Post 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
Alexander Riedel
SAPIEN Technologies, Inc.