Jul 25, 2016

Invoke-Command removing temp files

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: