VMSS files are suspended state files which store the state of a suspended VMware's virtual machine. Sometimes they linger on even when the VM has been resumed from suspension. They can take up a lot of space. This script will find those files and write them out to a file.
#clear screen
cls
#remove any lingering variables
Remove-Variable -Name * -Force -ErrorAction SilentlyContinue
$vCenters = 'vCenter1', 'vCenter2'
foreach ($vCenter in $vCenters)
{
$VIServer = Connect-VIServer $vCenter
foreach ($VM in (Get-View -ViewType VirtualMachine ))
{
$x = $VM.LayoutEx.File
Foreach ($File in $x)
{
if ($File.Name -like '*.vmss')
{
$output = $File.Name
$output
$output | Out-File c:\vmss.txt -Append
}
}
}
}
No comments:
Post a Comment