Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 225804

Re: Scripting the documentation of about 100 ESX servers

$
0
0

Without a vCenter server, you will probably have to create an input file with the hostname, username and password.

I would recommend the following.

 

Input (esxi.csv):

Name,Username,Password

test1.test.com,username,password

test2.test.com,username,password

test3.test.com,username,password

 

Script (make sure the input file, esxi.csv is in same directory with the script):

$output = foreach ($esxi in Import-Csv esxi.csv)

{

     Connect-VIServer -User $esxi.Username -Password $esxi.Password -Server $esxi.Name

     Get-VMHost -Name $esxi.Name | Select-Object @{N="ESXi";E={$_.Name}},

                                                                           @{N="Management IP";E={$_.ExtensionData.Summary.ManagementServerIP}},

                                                                           @{N="Virtual Machine";E={[string]::Join(",", ($_ | Get-VM | %{$_.Name}))}}                             

}

Disconnect-VIServer * -Confirm:$false

$output | Export-Csv output.csv

 

Sample Output:


esxtst01.test.com     443   root                                                                                                                                                                                                                                                                                    

                                                                                                                                                                                                                                                                                                                             

ESXi            : esxtst01.test.com

Management IP   : 10.1.1.1                                                                                                                                                                                                                                                                                            

Virtual Machine : test1,test2,test3,test4                                                                                                                                                                                                                                                                                    

                                                                                                                                                                                                                                                                                                                             

esxtst02.test.com     443   root                                                                                                                                                                                                                                                                                    

                                                                                                                                                                                                                                                                                                                             

ESXi            : esxtst02.test.com

Management IP   : 10.1.1.2                                                                                                                                                                                                                                                                                              

Virtual Machine : test5,test6,test7,test8       

 

Hope this helps,

Steven.                                                                                                                                                                                                                                                                           


Viewing all articles
Browse latest Browse all 225804

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>