Loading

Find  RDMs in your environment

This process will find any RDMs in your environment. I’ve found it useful as we attempt to phase out use of RDMs.

Get-VM | Get-HardDisk -DiskType “RawPhysical”,”RawVirtual” | Select Parent,Name,ScsiCanonicalName,DiskType

Cleanup Backup Snapshots

A common problem in our environment are “Consolidate” snapshots that our backup process leaves behind.  Find and irradicate those with this quick command:

Get-VM | Sort Name | Get-Snapshot | Where { $_.Name.Contains(“Consolidate”) } | Remove-Snapshot

Find Lost or Unknown Snapshots

Our backup process also seems to leave behind orphaned snapshots, snapshots vCenter or ESX no longer knows about. vCenter sees the VM in linked-clone mode, where the VMX file points to a snapshot VMDK instead of the original parent.

Compare-Object $(Get-VM | SORT | Get-Harddisk | WHERE { $_.Filename -like "0000" } | SELECT @{Name="VM";Expression={$_.Parent}} | Get-Unique -asstring) $(Get-VM | Get-Snapshot | SELECT VM | Get-Unique -asstring) -Property VM

Rescan All HBA and New Storage


get-cluster -nameclustername| get-vmhost | Get-VMHostStorage -RescanAllHBA

All Hosts in VC:
get-vmhost | Get-VMHostStorage -RescanAllHBA

List of VM’s created in the last 14 days

Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(–14) | where {$_.Gettype().Name-eqVmCreatedEvent-or$_.Gettype().Name-eqVmBeingClonedEvent-or$_.Gettype().Name-eqVmBeingDeployedEvent} |SortCreatedTime -Descending |Select CreatedTime, UserName,FullformattedMessage

List of VM’s removed in the last 14 days

Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(–14) |where {$_.Gettype().Name-eqVmRemovedEvent} |SortCreatedTime -Descending |Select CreatedTime, UserName,FullformattedMessage

(Visited 6 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.

Leave a Reply