Get-file & Get - VM

These are probably only difficult for me because I'm not familiar with powershell (yet). But here we are two issues here:

(1) if I run 'Get-file 'IT' ' I get two files returned that store data from view and that of the VMs & view models. How to limit this to just as the display of the model?

This also applies to certain folders in the same point of view; Assessment.1/Archives & Depart2 / Archive. If I want to create a virtual machine from the CLI how to know it one to use?

2) $vm = Get - VM 'X' refers to the virtual machine (shocking I know) now I want properties to be returned (VM Attrributes) this dosnt see the attributes that I want to access however ' $vm = Get - VM "X" | Get-View ', then' $vm2. AvailableField' kind of did, I want only one of the fields under AvailableField not all to be listed.

Ryan

Hello, RyanMcL-

This property of CustomFields is a 'ReadOnlyDictionary' object, which consists of key/value pairs.  So, you can return the values by accessing the desired key.

In your example, "Date of creation", "Retirement Date", "Department", and "Status" are the key.  To get the value desired here, access the key of "Ministry" as such:

PS C:\> (Get-VM "X").CustomFields["Department"]
IT

Enjoy.

Tags: VMware

Similar Questions

Maybe you are looking for