Windows 2008 End of Support – VM report

So hopefully everyone has already long dealt with the upcoming end of support date for Windows 2008 as detailed by MS here right?

Paying for extended support might be an option at this late stage but good to know exactly what you are dealing with.

I have used the following powercli code to query all vCenters for a report on 2008/2008r2 VMs to identify any stragglers or virtual servers that app owners have been too busy to update or mitigate.

Change the variables to suit your environment and comment out the filter (highlighted lines below) if you want to use to report on all VMs.

## VM Audit

## Connect to all linked vCenters

$VCCred = Get-Credential
$VCs = "VC1" , "VC2" , "VC3", "VC4", "VC5", "VC6"

Connect-VIServer $VCs -Credential $VCCred

## Get All VMs in selected DataCenters

$VMs = Get-VM
$OS = "Microsoft Windows Server 2008 R2 (64-bit)","Microsoft Windows Server 2008 (32-bit)","Microsoft Windows Server 2008 (64-bit)"

$VMs | ? {$_.ExtensionData.Guest.GuestFullname -in $OS} |
Select-Object Name,
PowerState,MemoryGB,NumCpu,ProvisionedSpaceGB,

 @{N='vCenter';E={$_.ExtensionData.Client.ServiceUrl.Split('/')[2].trimend(":443")}},
 @{N='ESXi';E={$_.VMHost.Name}},
 @{N='IP';E={$_.Guest.IPaddress[0]}},
 @{N='DNSName';E={$_.ExtensionData.Guest.Hostname}},
 @{N='vCPU';E={$_.NumCpu}},
 @{N='vRAM';E={$_.MemoryGB}},
 @{N="Datastore";E={[string]::Join(',',(Get-Datastore -Id $_.DatastoreIdList | Select-Object -ExpandProperty Name))}},
 #@{N='Cluster';E={(Get-CLuster -VM $_).Name}},
 @{N='Cluster';E={$_.vmhost.parent}},
 @{N='DataCenter';E={$_.vmhost.parent.parentfolder.parent}},
 @{N="Tools Installed";E={$_.Guest.ToolsVersion -ne ""}},
 @{N="Tools Status";E={$_.ExtensionData.Guest.ToolsStatus}},
 @{N="Tools version";E={if($_.Guest.ToolsVersion -ne ""){$_.Guest.ToolsVersion}}},
 @{N="Configured OS";E={$_.ExtensionData.Config.GuestFullName}},
 @{N="Running OS";E={$_.ExtensionData.Guest.GuestFullName}}, 
 notes |
 
 Export-Csv -Path C:\CT\Windows_2008_VMs.csv -NoTypeInformation -UseCulture
Share

You may also like...

Leave a Reply

Your email address will not be published.