This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Showing posts with label Power Shell. Show all posts
Showing posts with label Power Shell. Show all posts

Wednesday, November 1, 2017

How to get the Old Hardware VM Version list with Powercli command?

Wednesday, November 01, 2017 0
Execute the  below command with the cluster name and required hardware version that all.

Get-Cluster "Cluster Name" | Get-VM | Get-View | Where {$_.Config.Version -ne "vmx-09"} |  Select Name

Hope it is useful.

Saturday, September 16, 2017

Simple Powercli Code to Consolidate all vms which are Consolidation Needed

Saturday, September 16, 2017 0

Powercli Code to Consolidate all  vms  which are Consolidation Needed

Use the below command.

Get-VM |
Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} |
ForEach-Object {
  $_.ExtensionData.ConsolidateVMDisks()
}

Thursday, September 14, 2017

Powershell script to list the Virtual Machines in SCVMM

Thursday, September 14, 2017 0

Windows PowerShell (SCVMM)

SCVMM One-liner command 1:   Outputs the VMName, VM Configuration File path, VHDCount, VHD Location, VHDSize, MaxVHDSize, Cluster for all VMs managed by the SCVMM server connected by PowerShell (in a single line)

$report = @(); $vms = get-vm; foreach ($vm in $vms){foreach ($vhd in $vm.VirtualHardDisks){$maxvhdsize = [math]::Round($vhd.MaximumSize/1024/1024/1024,1); $vhdsize = [math]::Round($vhd.Size/1024/1024/1024,1); $row = "" | select VMName, VMCPath, VHDCount, VHDLocation, VHDSize, MaxVHDSize, VMCluster; $row.VMName = $vm.Name; $row.VMCPath = $vm.VMCPath; $row.VHDCount = $vm.VirtualHardDisks.Count; $row.VHDLocation = $vhd.Location; $row.VHDSize = $vhdSize; $row.MaxVHDSIze = $MaxVHDSize; $row.VMCluster = $vm.VMHost.HostCluster.Name; $report += $row;};};$report | export-csv C:\Temp\Hyper-V-VMs.csv -NoTypeInformation