ActiveXPosh and VirtualMachineManager

Support for all customers who have purchased or received a Productivity Pack Support product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
momoca
Posts: 2
Joined: Sun Aug 09, 2009 5:59 pm

ActiveXPosh and VirtualMachineManager

Post by momoca » Sun Aug 09, 2009 5:59 pm

Can someone please help me? Has anyone got ActiveXPosh and VirtualMachineManager to work for them? I'd appreciate any help or advice. Thanks!

Option Explicit Dim ActiveXPosh Dim Command Const OUTPUT_CONSOLE = 0 Const OUTPUT_WINDOW = 1 Const OUTPUT_BUFFER = 2 Function CreateActiveXPosh() Dim success Set ActiveXPosh = CreateObject("SAPIEN.ActiveXPoSH") success = ActiveXPosh.Init(vbFalse) If success <> 0 then WScript.Echo "Init failed" end if ActiveXPosh.OutputMode = OUTPUT_CONSOLE End Function CreateActiveXPosh
ActiveXPosh.Execute("Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager")

Command = "Get-VM"

ActiveXPosh.Execute(Command)

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

ActiveXPosh and VirtualMachineManager

Post by Alexander Riedel » Sun Aug 09, 2009 7:36 pm

It would help if you would elaborate on what error you get.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
momoca
Posts: 2
Joined: Sun Aug 09, 2009 5:59 pm

ActiveXPosh and VirtualMachineManager

Post by momoca » Mon Aug 10, 2009 12:13 am

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.At line:1 char:13+ Add-PSSnapin <<<< Microsoft.SystemCenter.VirtualMachineManager + CategoryInfo : InvalidArgument: (Microsoft.Syste...lMachineManager:String) [Add-PSSnapin], PSArgumentException + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommandThe term 'get-vm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:7+ get-vm <<<< + CategoryInfo : ObjectNotFound: (get-vm:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

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

ActiveXPosh and VirtualMachineManager

Post by Alexander Riedel » Mon Aug 10, 2009 7:12 pm

The error clearly indicates that the snapin is not installed. Are you trying to access a 64 bit snapin from a 32 bit component?
Alexander Riedel
SAPIEN Technologies, Inc.

Locked