I'm working on an automaton script for use by our end users in SCCM. Everything is working the way i want it to except for the section for launching outlook with the /cleanviews switch in a hidden window.
Current script section
$path = "C:\Program Files (x86)\Microsoft Office\root\Office16"
$path2 = "C:\Program Files\Microsoft Office\root\Office16"
Test-path $path
if($True){
Start-Process -workingdirectory $path OUTLOOK.EXE /cleanviews -WindowStyle Hidden -ErrorAction Ignore}
Else {
Start-Process -workingdirectory $path2 OUTLOOK.EXE /cleanviews -WindowStyle Hidden -ErrorAction Ignore}
Start-Sleep -s 15
get-process OUTLOOK -ErrorAction ignore | stop-process
Start-Sleep -s 5
I've also tried removing the -working directory portion, and moving -windowstyle from the end to directly after start-process. So far the application is launching in a normal window
There is another script section after this portion and the reason i don't want our users to see the second window during the cleanviews switch is because they could easily freak out with it closing again and or interrupt the script.
suggestions?