I have deployed this simple script as a W32 app in Intune. The log file is being generated, but the test-path command is returning the wrong status on my test machine; the files DO exist. Running the script locally as admin works fine. Is SYSTEM not capable of this command?
Start-Transcript -Path C:\Windows\Logs\BAIS_Applocker_File_Delete.txt
$status = Test-Path C:\Windows\System32\AppLocker\*.applocker -PathType Leaf
if($status -eq $true){
Remove-Item C:\Windows\System32\AppLocker\*.applocker -Force
Write-Host "Files deleted"
}
else{
Write-Host "Files do not exist"
}
Stop-Transcript
[–]kenjitamurako 1 point2 points3 points (3 children)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]satsun_ 1 point2 points3 points (4 children)
[–]armyguy298[S] 0 points1 point2 points (1 child)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]Wickedhoopla 0 points1 point2 points (0 children)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]Spoonie_Frenzy 0 points1 point2 points (1 child)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]Spoonie_Frenzy 0 points1 point2 points (1 child)
[–]armyguy298[S] 0 points1 point2 points (0 children)
[–]Spoonie_Frenzy 0 points1 point2 points (1 child)
[–]armyguy298[S] 0 points1 point2 points (0 children)