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.
This topic is 12 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
hitec92407
Posts: 8
Last visit: Sun Oct 09, 2011 7: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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

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.
This topic is 12 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.