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
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
ActivePoSh and Exchange 2007 shell
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
I'll double check as soon as I get to it
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.