-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUninstallAdobeMulti.ps1
More file actions
65 lines (44 loc) · 1.97 KB
/
UninstallAdobeMulti.ps1
File metadata and controls
65 lines (44 loc) · 1.97 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Param(
$ScriptFile = "Get-WMIObject -ComputerName $Computer -Class Win32\_Product | Where-Object { $\_.Name -Like 'Adobe Acrobat DC\*'}",
$AdobeComputers = (Import-Csv $PSScriptRoot\UninstallAdobePro.csv),
$MaxThreads = 20,
$OutputType = "Text")
$Computers = $AdobeComputers
Write-Verbose "Killing existing jobs . . ." -Verbose
Get-Job | Remove-Job -Force
Write-Verbose "Done." -Verbose
$Count = 0
ForEach ($Computer in $Computers) {
If ((Test-Path "\\$($Computer.ComputerName)\c$") -eq $True) {
While ($(Get-Job -State Running).Count -ge $MaxThreads) {
Write-Progress -ID 0 -Activity "Creating Adobe List" -Status "Waiting for threads to close" -CurrentOperation "$Count threads created - $($(Get-Job -State Running).Count) threads open" -PercentComplete (($Count / $Computers.Count) * 100)
}
}
Else {
Write-Verbose "$Computer.ComputerName doesn't ping"
}
$Job = Start-Job -ScriptBlock { $ScriptFile } | Out-Null
Write-Progress -ID 0 -Activity "Creating Computer List" -Status "Starting Threads" -CurrentOperation "$Count threads created - $($(Get-Job -state running).Count) threads open" -PercentComplete (($Count / $Computers.count) * 100)
$Count++
}
$Complete = Get-date
While ($(Get-Job -State Running).count -gt 0){
$ComputersStillRunning = ""
ForEach ($System In $(Get-Job -state running)){$ComputersStillRunning += ", $($System.name)"}
$ComputersStillRunning = $ComputersStillRunning.Substring(2)
Write-Progress -Activity "Creating Server List" -Status "$($(Get-Job -State Running).count) threads remaining" -CurrentOperation "$ComputersStillRunning" -PercentComplete ($(Get-Job -State Completed).count / $(Get-Job).count * 100)
}
Write-Verbose "Reading All Jobs" -Verbose
$Out = Get-Job $Job Wait-Job
$Job | Receive-Job
If ($OutputType -eq "Text"){
ForEach($Job in Get-Job){
"$($Job.Name)"
"****************************************"
Receive-Job $Job
" "
}
}
ElseIf($OutputType -eq "GridView"){
Get-Job | Receive-Job | Select-Object * -ExcludeProperty RunSpaceID | Out-GridView
}