FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Trouble with GetObject / CreateObject
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Trouble with GetObject / CreateObject
Posted: Fri Aug 20, 2021 07: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Trouble with GetObject / CreateObject
Posted: Fri Aug 20, 2021 09:12 PM

have you tried:

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

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion