After the Crowd Strike debacle I have multiple Windows servers that have large .dmp files I am attempting to delete. I have come up with that attached powershell script with no success. I have tried using the admin share path as well with no success. I have tried removing the variables and typing out the path and each time it returns, “Path does not exist.” I have also attempted running in an admin console, rebooting the server to make sure the file isnt still in use, I have manually deleted the same file without issue. I am at a loss. Can someone that knows more about Powershell than myself help? Please. I sincerely appreciate any assistance.
$computers = Get-Content -Path C:tempComputers.txt
$filePath = "C:Windowsmemory.dmp"
foreach($computer in $computers){
if (Test-Path -Path $filePath) {
Remove-Item -Path $filePath}
else {
Write-Host "Path does not exist"}
}
The output:
PS C:Windowssystem32> $computers = Get-Content -Path C:tempComputers.txt
$filePath = "C:Windowsmemory.dmp"
foreach($computer in $computers){
if (Test-Path "C:Windowsmemory.dmp") {
Remove-Item "C:Windowsmemory.dmp"}
else {
Write-Host "Path does not exist"}
}
Path does not exist
No matter what I try I get the same result, the file does not exist. I have validated that it does in fact exist.
1