34 lines
1000 B
PowerShell
34 lines
1000 B
PowerShell
<#
|
|
.SYNOPSIS
|
|
A short one-line action-based description, e.g. 'Tests if a function is valid'
|
|
.DESCRIPTION
|
|
A longer description of the function, its purpose, common use cases, etc.
|
|
.NOTES
|
|
Information or caveats about the function e.g. 'This function is not supported in Linux'
|
|
.LINK
|
|
Specify a URI to a help page, this will show when Get-Help -Online is used.
|
|
.EXAMPLE
|
|
Test-MyTestFunction -Verbose
|
|
Explanation of the function or its result. You can include multiple examples with additional .EXAMPLE lines
|
|
#>
|
|
|
|
function Remove-ITDVMwareOSCustomizationSpecOrphan {
|
|
[CmdletBinding()]
|
|
param (
|
|
[int]
|
|
$DaysToKeep = 60
|
|
)
|
|
|
|
begin {
|
|
|
|
}
|
|
|
|
process {
|
|
$OSCustomizationSpecToRemove = Get-OSCustomizationSpec | Where-Object { $_.Name -like "AutoBuild-*" -and $_.LastUpdate -lt ((Get-Date).AddDays($DaysToKeep)) }
|
|
$OSCustomizationSpecToRemove | Remove-OSCustomizationSpec -Confirm:$false
|
|
}
|
|
|
|
end {
|
|
|
|
}
|
|
} |