logonewone

#Run on system logged in as the user you are trying to delete and recreate the profile for

if (test-path “$Env:USERPROFILE\outlookprofiledelete.log”){

}

else {

if(Test-Path “$Env:USERPROFILE\AppData\Local\Microsoft\Outlook”){

$PathTrue = 1

Remove-Item “$env:USERPROFILE\AppData\Local\Microsoft\Outlook\*.*” -force | Out-File $Env:USERPROFILE\outlookprofiledelete.log

}

}

if(Test-Path HKCU:\Software\Microsoft\Office\15.0\Outlook)

{

New-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Outlook\AutoDiscover -Name ZeroConfigExchange -Value 1 -PropertyType DWORD -Force

Remove-Item “HKCU:\Software\Microsoft\Office\15.0\Outlook\Profiles\outlook” -Recurse -Force

Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Outlook\Setup\ -name First-Run

}

else{Write-Output ‘Outlook 2013 is not installed on this system’}

if(Test-Path HKCU:\Software\Microsoft\Office\16.0\Outlook)

{

New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\AutoDiscover -Name ZeroConfigExchange -Value 1 -PropertyType DWORD -Force

Remove-Item “HKCU:\Software\Microsoft\Office\16.0\Outlook\Profiles\outlook\*” -Recurse -Force

Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Setup\ -name First-Run

}

else{Write-Output ‘Outlook 2016 is not installed on this system’}