Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

VMWARE VCLI output format

$
0
0

Hi,

I am in need to extract persistentID and MAC address for vms in a Vcenter. upon digging, it looks to me that single cmdlet is not enough to fetch both details.

GET-vm to get persistenID and GEt-networkadapter to get the mac address.

Now,i am trying to out-file them in a single txt file.

Rough example i just prepared:

$vms = get-content "c:\support\citrixuptime\VMINFO\servers.txt"

Foreach($vm in $vms){

get-networkadapter -vm $vm| select Macaddress| out-file c:\support\citrixuptime\vminfo\result.txt
Get-vm -name $vm| select name,persistentID| out-file c:\support\citrixuptime\vminfo\result.txt -append

}

MY QUERY:

With this script, is it possible for me to format the output in such a way that all three columns get in a single row and it will make my objective complete.

 

Currently, output is like as below:

MacAddress                                                                                                            
----------                                                                                                            
00:50:56:88:20:bb                                                                                                     



Name                                                        PersistentId                                              
----                                                        ------------                                              
NEDPRTGPB705                                                5008fdfe-b95d-f6c8-34ed-ac469dbcbecb

 

Thanks in advance


Viewing all articles
Browse latest Browse all 6937

Trending Articles