Couradical
Couradical

Reputation: 175

How to get an instance of Msvm_VirtualSystemGlobalSettingData class for particular VM in Powershell

So, I've been trying my hand at powershell automation of Hyper-V VM administration, and I can't seem to find a reliable way to find the VM Data Root for a given VM. I understand that when programmatically building one, I set it via the Msvm_VirtualSystemGlobalSettingData WMI class. How do I access this class post VM creation?

Thanks!

Upvotes: 1

Views: 749

Answers (1)

Eric Nicholson
Eric Nicholson

Reputation: 4123

The GetRelated() method is the key:

PS C:\> $vm = gwmi -namespace root\virtualization Msvm_ComputerSystem -filter 'ElementName="SomeVM"'
PS C:\> $vm.GetRelated("Msvm_VirtualSystemGlobalSettingData")

Upvotes: 1

Related Questions