Category Archives: PowerShell Scripts

Powershell scripts to make your life easier

Tracking VM Creation and Deletion events using PowerCLI

Below script is used to find the users who created or deleted the VM in the past 7 days. Note: If you want to know the count for longer period then change the value of AddDays. For VM creation Get-VIEvent -MaxSamples ([int]::MaxValue) -Start … Continue reading

Posted in PowerShell Scripts, Vmware | Leave a comment

vMotion Count using PowerCLI

Below script can help you to get the count of all vMotion events that has happened in the past 24 hrs. If you want to calculate the count for longer period then change the number AddDays. Get-VIEvent -Entity (Get-VM -Location $_) -MaxSamples … Continue reading

Posted in PowerShell Scripts, Vmware | Leave a comment

Tracking SvMotion events with the help of PowerCLI

The Storage vMotion events can be tracked using the below script. You can use this script to the get the count of Storage vMotion events in the past 24 hrs. Get-VIEvent -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddDays(-1) | Where { $_.GetType().Name -eq “TaskEvent” … Continue reading

Posted in PowerShell Scripts, Vmware | Leave a comment

Powershell Script to pull records with VM-Name,LUN-Name and Vmdk file name and its path.

This script will export following information into a .csv file: 1) name of the virtual machine (VM) 2) datacenter name 3) cluster name 4) hard disc 5)datastore name 6) path and name of the .vmdk file Note: Change vCenter Server … Continue reading

Posted in PowerShell Scripts, Vmware | Leave a comment

PowerShell Script to List all VM’s with a connected CD-ROM/floppy device

This script will report all VMs with a connected CD-ROM/floppy device. It will give you information about the device status – e.g. connected, connect at power on, client device Replace vCenter Server with your vCenter Server name in the first … Continue reading

Posted in PowerShell Scripts, Vmware | Leave a comment

PowerShell script to list vm-name-nic-type-and-mac-adress

This script will report the following parameters: VM name, type of the virtual network adapter and MAC address associated with each network adapter. Note: Replace vCenter Server with your vCenter Server name in the first line: Connect-VIServer vCenterServer $VMs = … Continue reading

Posted in PowerShell Scripts, Vmware | Leave a comment