Last active
July 3, 2021 14:17
-
-
Save kmondesir/792ca30a770c662ba1c6f2e19d2604a1 to your computer and use it in GitHub Desktop.
Get the vCenter Server from the virtual machine name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/get-vCenter-name-for-VM/td-p/318609 | |
New-VIProperty -Name vCenterServer -ObjectType VirtualMachine -Value {$Args[0].Uid.Split(":")[0].Split("@")[1]} | |
Get-vm YourVMName | Select-Object -Property Name,vCenterServer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment