Forum Discussion
monkeybradders
Jan 15, 2025Copper Contributor
help with remediation
Hi, i'm trying to create detection and remediation scripts for intune to detect the presence of a template in the users word startup folder
**My detection is as follows**
$path = "C:\Users\$env:USERNAME\AppData\Roaming\Microsoft\Word\Startup\ACS Template 2010 2013 2016 (2) (1).dotm"
if (Test-Path $path) {
Write-Output "File exists: $path"
exit 1 # Success, file exists
} else {
Write-Output "File not found: $path"
exit 0 # Failure, file does not exist
**My remediation**
$path = "C:\Users\$env:USERNAME\AppData\Roaming\Microsoft\Word\Startup\ACS Template 2010 2013 2016 (2) (1).dotm"
if (Test-Path $path) {
Remove-Item -Path $path -Force
It seems like the detection works as the detection status is "without issues" but the remediation doesn't run.
Any advice on how to correct this very much welcomed
- rahuljindal-MVPBronze Contributor
If the remediation is showing ‘without issue’ that means it is an exit code 0. Does the file even exist on the device in question m?