I am looking for a script to run to remove files from each userprofile + path ex: userprofile\Appdata\Microsoft\Windows\WER\ReportQueue*
I tried
Remove-Item "C:\users + \AppData\Local\Microsoft\Windows\WER\ReportQueue\AppCrash*"
No go.
Also tried VBScript:
Set fso = CreateObject("Scripting.FileSystemObject")
strOneDrivePath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%USERPROFILE%") & "\AppData\Local\Microsoft\Windows\WER\ReportQueue\"
Search strOneDrivePath
Sub Search(str)
Set folder = fso.GetFolder(str)
For Each file In folder.Files
If file.DateLastModified < (Now() - 3) Then
file.Delete True
End If
Next
For Each subFolder In folder.SubFolders
Search subFolder.Path
If subFolder.Files.Count = 0 Then
subFolder.Delete True
End If
Next
End Sub