-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathuninstall.ps1
27 lines (19 loc) · 1.04 KB
/
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
27
write-host " *** Exchange CatchAll UNINSTALL Script ***" -f "blue"
$EXDIR="C:\Program Files\Exchange CatchAll"
Net Stop MSExchangeTransport
write-host "Disabling agent..." -f "green"
Disable-TransportAgent -Identity "Exchange CatchAll"
write-host "Uninstalling agent..." -f "green"
Uninstall-TransportAgent -Identity "Exchange CatchAll"
write-host "Deleting directories and files..." -f "green"
Remove-Item $EXDIR\* -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $EXDIR -Recurse -Force -ErrorAction SilentlyContinue
write-host "Removing registry key for EventLog" -f "green"
if (Test-Path "HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application\Exchange CatchAll") {
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application\Exchange CatchAll"
} else {
write-host "Key already removed. Continuing..." -f "yellow"
}
write-host "Starting Transport..." -f "green"
Net Start MSExchangeTransport
write-host "Uninstallation complete. Check previous outputs for any errors!" -f "yellow"