Last active
July 5, 2017 13:31
-
-
Save MarkDarwin/6b7447215d766303c23dd29f94bb73d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Get a list of all VM's with version numbers to see if any need upgrading | |
#Move to PowerCli scripts folder and initialise | |
$PowerCliPath = "${env:ProgramFiles(x86)}\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1" | |
$VIServer = "blah","blah2" | |
if (Test-Path -Path $PowerCliPath){ | |
Write-Verbose -Message $PowerCliPath | |
$Installed = $true | |
} | |
If ($Installed -eq $true){ | |
. $PowerCliPath $true | |
Connect-VIServer -Server $VIServer -Credential (Get-Credential) | |
} | |
#Make new properties to store version information in | |
New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine -ValueFromExtensionProperty 'Config.tools.ToolsVersion' -Force | |
New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty 'Guest.ToolsVersionStatus' -Force | |
#Get the list | |
Get-VM | Select Name, Version, ToolsVersion, ToolsVersionStatus | Sort-Object Version | Format-Table -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment