Powershell files ( .ps1xml \ .dll ) disappearing

Hi,

I have a strange issue on a Win2008R2 server. We're using a scheduled PS script, that fetches data ( start \ end time - size - status ) from various veeam b&r jobs using the veeam powershell snapin . The script outputs the requested data on a local text file, later our monitoring solution read that file .

Randomly we get errors in our monitoring agent, warning that the PS script cannot found files :

'C:\Windows\System32\WindowsPowerShell\v1.0\types.ps1xml'. Could not find file 'C:\Windows\System32\WindowsPowerShell\v1.0\Certificate.format.ps1xml'.

Accessing that folder, i saw that many files are deleted, i've enabled the file auditing feature on that folder and i saw that around the time when the scheduled script runs, i see a bunch of DELETE access request ( in the PS script i didnt have any command \ cmdlet regarding file deletions ) .

Did this ever occur to anyone ?

Bye and Thanks

Posted Jul 8, 2016, 7:34 AM UTC

64
Michichael•

Likely an antivirus.

1
RedditanoOP•

Hello,

It was one of the first thing i've checked and the file werent' deleted \ quarantined by the AV .

The process stated in the auditing event, was powershell.exe itself .

1
Michichael•

types.ps1xml

Apparently they're referencing outputs that you're dropping out. ARe you storing those outputs in a sane location like a temp directory?

http://texhex.blogspot.com/2008/08/automatically-generating-powershell.html

1
RedditanoOP•

Maybe i've found the culprit .

There was a forgotten post-backup PS script that archived some files, in this script there was an error in a working folder variable that uses a non-existent path . I think that this non-existant path lead the powershell script to work in the c:\windows\system32... folder .

Thanks

1