-
Notifications
You must be signed in to change notification settings - Fork 0
/
Create-Uninstall.ps1
26 lines (22 loc) · 952 Bytes
/
Create-Uninstall.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Write-Host '
********************************** Caution **********************************'
Write-Host 'This PoSH Script creates Uninstall Commands for PowerCLI under "C:temp" Directory.
*****************************************************************************
'
$ExpName = Get-InstalledModule VMware*
$Mods =@($ExpName)
$CommandList=@()
foreach ($Mod in $Mods){
$ModArray=@{
"Uninstall Command (Requires Admin)" = "Uninstall-Module " + $Mod.Name + " -Force"
}
$Buffer = New-Object PSCustomObject -Property $ModArray
$CommandList += $Buffer
}
$OutputFileName = "C:\temp\UninstComList-" + (Get-Date).ToString("yyyyMMdd-HHmmss") +".txt"
$CommandList | Out-File $OutputFileName -Encoding Default
Write-Host '
********************************** Caution **********************************'
Write-Host $OutputFileName 'is successfully created.
*****************************************************************************
'