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)
ActiveXPosh and VirtualMachineManager
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
ActiveXPosh and VirtualMachineManager
It would help if you would elaborate on what error you get.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
ActiveXPosh and VirtualMachineManager
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
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
ActiveXPosh and VirtualMachineManager
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.
SAPIEN Technologies, Inc.