Trouble with GetObject / CreateObject

Trouble with GetObject / CreateObject

Postby byron.hopp » Fri Aug 20, 2021 7:33 pm

All,

I am using some code I found on the web to reset a VM on Hyper-V.

VBScript:
Set sService = GetObject("winmgmts:\\.\root\virtualization")

FWH:
oWinMgmt := CreateObject("winmgmts:\\.\root\virtualization")
oWinMgmt := GetActiveObject("winmgmts:\\.\root\virtualization")
oWinMgmt := Win_OleGetActiveObject("winmgmts:\\.\root\virtualization")

Also tried (based on a post from 2007):
oWinMgmt := CreateObject("winmgmts:")

Everything I have tried:
Valtype( oWinMgmt ) == "U"

I am running this on the Server that hosts the VM systems.

I can run a powershell command and get this accomplished:

Reset-VM -Name "Windows 10_04_New" -Force

Anyone familiar with this?

Thanks,
Byron ...
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Trouble with GetObject / CreateObject

Postby Antonio Linares » Fri Aug 20, 2021 9:12 pm

have you tried:

hb_Run( "Reset-VM -Name "Windows 10_04_New" -Force" )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 47 guests