As part of the VMware open source program, we have to update this repository with the correct license and copyright information. We add the BSD-2 Clause License for this repository. We mark all source code provided by VMware with the Copyright notice under BSD-2 Clause license. * Update repository license to BSD 2-Clause License * Update Copyright
40 lines
1.1 KiB
PowerShell
40 lines
1.1 KiB
PowerShell
<#
|
|
Copyright 2021 VMware, Inc.
|
|
SPDX-License-Identifier: BSD-2-Clause
|
|
#>
|
|
function Check-Tools {
|
|
<#
|
|
.NOTES
|
|
===========================================================================
|
|
Created by: Brian Graf
|
|
Organization: VMware
|
|
Official Blog: blogs.vmware.com/PowerCLI
|
|
Personal Blog: www.vtagion.com
|
|
Twitter: @vBrianGraf
|
|
===========================================================================
|
|
.DESCRIPTION
|
|
This will quickly return all VMs that have VMware Tools out of date
|
|
Along with the version that it is running
|
|
.Example
|
|
Check-Tools -VMs (Get-VM)
|
|
.Example
|
|
$SampleVMs = Get-VM "Mgmt*"
|
|
Check-Tools -VMs $SampleVMs
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory=$true,
|
|
ValueFromPipeline=$True,
|
|
Position=0)]
|
|
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]
|
|
$VMs
|
|
)
|
|
Process {
|
|
#foreach ($VM in $VMs) {
|
|
$OutofDate = $VMs | where {$_.ExtensionData.Guest.ToolsStatus -ne "toolsOk"}
|
|
$Result = @($OutofDate | select Name,@{Name="ToolsVersion";Expression={$_.ExtensionData.Guest.Toolsversion}})
|
|
|
|
$Result
|
|
}
|
|
|
|
} |