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

New PowerCLI Release: PowerCLI 6.5 R1

PowerCLI 6.5 R1

VMware just release a new version of PowerCLI just today.  Like every new release, they have packed with one with a ton of new features, and updates to the existing cmdlets to help with automation and daily operations.

Updated Cmdlets

Move-VM – This cmdlet has been updated to support the ability to vMotion machines between vCenters.  … 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

Issues with PowerShell Modules and Duplicate Cmdlets

At the end of the day I always take my laptop with me as I never know when I’ll get a call about server issues.  So my PowerShell sessions remain open all of the time, with all of the modules loaded.  Granted I do save my scripts that I work on frequently, and I had a problem before losing a few scripts without having a recent save.  … Continue reading