Difference between revisions of "Using PowerCLI in Powershell"

From Tech-Wiki
Jump to: navigation, search
(Created page with "Category:VMware How to use PowerCLI to output VM information for ESXi. Install-Module -Name VMware.PowerCLI Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP...")
 
Line 4: Line 4:
  
 
  Install-Module -Name VMware.PowerCLI  
 
  Install-Module -Name VMware.PowerCLI  
 
 
  Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false  
 
  Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false  
 
 
  Set-PowerCLIConfiguration -InvalidCertificateAction Ignore  
 
  Set-PowerCLIConfiguration -InvalidCertificateAction Ignore  
 
 
  Connect-VIServer 10.1.1.10
 
  Connect-VIServer 10.1.1.10
 
 
  Get-VM | Select Name,PowerState,MemoryGB,NumCpu,UsedSpaceGB   
 
  Get-VM | Select Name,PowerState,MemoryGB,NumCpu,UsedSpaceGB   
 
 
  Get-Cluster "Test-*" | Get-VM | Sort | Select Name, @{N="IP Address";E={$_.guest.IPAddress[0]}} | export-csv report.csv -NoTypeInformation –UseCulture  
 
  Get-Cluster "Test-*" | Get-VM | Sort | Select Name, @{N="IP Address";E={$_.guest.IPAddress[0]}} | export-csv report.csv -NoTypeInformation –UseCulture  
 
 
  Get-VM | Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName") | Select -Property Name, @{N="Running OS";E={$_.Guest.GuestFullName}} | Format-Table -AutoSize
 
  Get-VM | Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName") | Select -Property Name, @{N="Running OS";E={$_.Guest.GuestFullName}} | Format-Table -AutoSize

Revision as of 18:49, 24 August 2023


How to use PowerCLI to output VM information for ESXi.

Install-Module -Name VMware.PowerCLI 
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false 
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore 
Connect-VIServer 10.1.1.10
Get-VM | Select Name,PowerState,MemoryGB,NumCpu,UsedSpaceGB  
Get-Cluster "Test-*" | Get-VM | Sort | Select Name, @{N="IP Address";E={$_.guest.IPAddress[0]}} | export-csv report.csv -NoTypeInformation –UseCulture 
Get-VM | Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName") | Select -Property Name, @{N="Running OS";E={$_.Guest.GuestFullName}} | Format-Table -AutoSize