Monday, July 25, 2016

Cleaning remote temp files with PowerShell

For some reason c:\windows\temp seems to be filling up with Windows Updates on a lot of our servers. Here is a quick Invoke-Command solution.
Invoke-Command -ComputerName $computername -ScriptBlock {Remove-Item c:\windows\temp\* -Force -Recurse}
Invoke-Command -ComputerName $computername -ScriptBlock {Get-PSDrive c}

No comments:

Post a Comment