User Tools

Site Tools


vmware_powercli

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

vmware_powercli [2023/06/29 15:06] – created davidvmware_powercli [2023/06/29 15:09] (current) – PowerCLI Code Snippits david
Line 1: Line 1:
-Find subnet a VM is in using VMware Tools:+===Find subnet a VM is in using VMware Tools:===
  
 <code powershell> <code powershell>
Line 16: Line 16:
         [String]::Join('.', $DottedIP)          [String]::Join('.', $DottedIP) 
     }}     }}
 +</code>
 +
 +===Get a csv file listing all VMs and their tags===
 +<code powershell>
 +Get-VM |
 +Select-object Name,
 +
 +   @{N = 'vCenter'; E = {([system.uri]$_.ExtensionData.Client.ServiceUrl).Host}},
 +
 +   @{N = 'Tags'; E = {(Get-TagAssignment -Entity $_).Tag -join '|'}},
 +
 +   PowerState, Notes, Guest, NumCpu, CoresPerSocket, MemoryMB, MemoryGB, VMHostId, VMHost,
 +
 +   Folder, Version, GuestId, UsedSpaceGB, ProvisionedSpaceGB |
 +
 +Export-Csv -path “c:\Temp\tags.csv” –NoTypeInformation -UseCulture
 </code> </code>
vmware_powercli.1688051214.txt.gz · Last modified: 2023/06/29 15:06 by david