Author Posts

January 20, 2015 at 12:51 pm

I have this short script that reads a list of computers and deletes the contents of the Desktop and Documents folder. I have it excluding 1 file, but it doesn't seem to work for .exe (programs) – unless I've been inputting it wrong.

$computers = Get-Content C:\users\*\desktop\computers.txt
      invoke-command -computername $computers {remove-item -Path "C:\users\*\documents\*", "C:\users\*\desktop\*" -recurse -Exclude Survey2015.pdf} | Out-Null[

January 20, 2015 at 1:03 pm

Nevermind, I could just use *exe*.