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

Re: VC's inventory using powercli

$
0
0

Hi bjeevan,

 

Welcome to the VMware VMTN Communities.

 

To be able to run PowerCLI commands against multiple vCenter servers you have to set the DefaulltVIServerMode to Multiple with:

 

Set-PowerCLIConfiguration-DefaultVIServerModeMultiple-ScopeUser-Confirm:$false

 

Now you can connect to multiple vCenter servers with:

 

Connect-VIServer-Server vCenter1,vCenter2

 

Finally you can run the following PowerCLI script to retrieve the desired information and save the output in the file VMsInfo.csv:

 

New-VIProperty-NamevCenter-ObjectTypeVirtualMachine`  -Value {$Args[0].Uid.Split(:)[0].Split(@)[1]} -Force | Out-NullGet-VM |Select-Object-Property vCenter,
VMHost,
@{N="VM";E={$_.Name}},
@{N="Guest OS";E={$_.Guest.OSFullName}},
Notes,
@{N="Datastores";E={[string]::Join(',',(Get-View-Id$_.DatastoreIdList).Name)}},
@{N="VMware Tools version";E={$_.ExtensionData.Config.Tools.ToolsVersion}} |Export-Csv-PathVMsInfo.csv-NoTypeInformation-UseCulture

Viewing all articles
Browse latest Browse all 249166

Trending Articles



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