50 lines
1.0 KiB
PowerShell
50 lines
1.0 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Removes old versions of ITD modules
|
|
.DESCRIPTION
|
|
Long description
|
|
.EXAMPLE
|
|
Example of how to use this cmdlet
|
|
.EXAMPLE
|
|
Another example of how to use this cmdlet
|
|
.INPUTS
|
|
Inputs to this cmdlet (if any)
|
|
.OUTPUTS
|
|
Output from this cmdlet (if any)
|
|
.NOTES
|
|
General notes
|
|
.COMPONENT
|
|
The component this cmdlet belongs to
|
|
.ROLE
|
|
The role this cmdlet belongs to
|
|
.FUNCTIONALITY
|
|
The functionality that best describes this cmdlet
|
|
#>
|
|
function Uninstall-ITDModuleOldVersion {
|
|
[CmdletBinding()]
|
|
Param
|
|
(
|
|
)
|
|
|
|
begin {
|
|
}
|
|
|
|
process {
|
|
$InstalledModules = Get-InstalledModule -Name ITD.*
|
|
|
|
try {
|
|
$InstalledModules | ForEach-Object {
|
|
$CurrentVersion = $_.Version
|
|
Get-InstalledModule -Name $_.Name -AllVersions | Where-Object -Property Version -LT -Value $CurrentVersion
|
|
} | Uninstall-Module -Verbose
|
|
}
|
|
catch {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end {
|
|
|
|
}
|
|
} |