-
Notifications
You must be signed in to change notification settings - Fork 0
/
raab-2.ps1
29 lines (25 loc) · 1.07 KB
/
raab-2.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
28
29
$olApp = New-Object -ComObject Outlook.Application
$olApp.Quit()
Remove-Variable olApp
Get-ChildItem $env:LOCALAPPDATA\Microsoft\Outlook\* -Include dirigenten_rbartists_at*, solisten_rbartists_at*, tournee1_rbartists_at* | Remove-Item
$Profiles = Get-ChildItem 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles\Outlook' |foreach {
Get-ChildItem $_.Name |foreach {
Get-ChildItem -Path $_.Name
}
}
foreach($Profile in $Profiles){
try{
$AccountName = Get-ItemPropertyValue -Path $Profile.Name -Name 'Account Name' -ErrorAction Stop
if($AccountName -like 'dirigenten_rbartists_at*'){
'HKCU:\' + ($Profile.Name.Split('\')[1..7] -join '\') | Remove-Item -Recurse
}
if($AccountName -like 'solisten_rbartists_at*'){
'HKCU:\' + ($Profile.Name.Split('\')[1..7] -join '\') | Remove-Item -Recurse
}
if($AccountName -like 'tournee1_rbartists_at*'){
'HKCU:\' + ($Profile.Name.Split('\')[1..7] -join '\') | Remove-Item -Recurse
}
}catch{
Continue
}
}