Using PowerCLI to Find Datastore with Missing VM

PowerCLI to Find Datastore with missing VM

During the last maintenance window at work, we starting having issues with vCenter, so to resolve the issues vCenter services were restarted.  After the vCenter services came back up, I noticed one of the servers on a host had lost it connection.  To make things worse, the datastore for the VM changed from the human readable format to location name.… Continue reading

Get vMotion IPs from all VMHost

I was recently asked to gather the vMotion IPs for all of the hosts in our environment. We have about 80 or so VM Hosts, so this was a job for PowerCli.  Below is the script.

$Report = @()

$Clusters = Get-Cluster | Sort Name

ForEach ($Cluster in $Clusters){
    $VmHosts = $Cluster | Get-VmHost | Where {$_.ConnectionState -eq “Connected”} | Sort Name
        ForEach ($VmHost in $VmHosts){
            $Report += Get-VMHostNetworkAdapter -VMHost $VmHost.Name -VMKernel | Where {$_.VMotionEnabled -eq “True”} | select VmHost,IP
        }
}
$Report | Export-Csv C:\Scripts\Logs\vMotionIPs.csv -NoTypeInformation -UseCulture
vMotion IPs Gather from the Script
vMotion IPs
vMotion IPs gather with PowerCLI

First there needs to be a place to put all of the information that is going to be collected.  … Continue reading

VMware PowerCLI Hands-on-Learning Review

Have you been wanting to learn PowerCLI but don’t have a test environment to practice with out the fear of breaking live production? That is where this hands-on-learning (HOL) lab from VMware can come in handy.  I personally worked through this HOL and found that the information that was provide to be very thorough to help with beginners wanting to start with PowerCLI.  … Continue reading

PowerCli to get list of unused RDMs on VM Cluster – Updated

After finishing the last post and starting to use it after limited testing I found that my script wasn’t filtering out the Datastores as expected.  This information was presented to me via our storage team.  So I have went back to the Integrated Scripting Environment (ISE) to resolved my issues.

$Cluster = "Cluster name here"
#This Line gets all of the LUNs that are connected to the first host in the cluster.
Continue reading

PowerCli to get list of unused RDMs on VM Cluster

This page has been updated. Please visit http://notesofascripter.com/?p=23 for the updated script.

Since my last post was about RDMs, lets continue the discusion.  In my work environment we have been consolidating our VMware platform.
So we have been moving VMs with RDMs attached from one cluster to another.  So its been a messy process, and we haven’t had the time to
clean up behind ourselves. … Continue reading