2016-11-11 95 views
0

我有這個,我一直在努力今天,但我認爲有一個更好的方法。謝謝您的幫助。目標是爲用戶清理Citrix。有時他們會得到一個糟糕的.ica文件。更多邏輯到腳本

Stop-Process -processname Receiver 
sleep 60 
Remove-Item $env:LOCALAPPDATA\temp\*.ica 
Remove-Item $env:LOCALAPPDATA\temp\2\CTXReceiverLogs -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\2 -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\3\CTXReceiverLogs -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\3 -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\4\CTXReceiverLogs -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\4 -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\CTXReceiverLogs\1\*.etl 
Remove-Item $env:LOCALAPPDATA\temp\CTXReceiverLogs\1\ -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\CTXReceiverLogs\ -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\CitrixLogs -Recurse 
Remove-Item $env:LOCALAPPDATA\temp\*.tmp -Recurse 
+1

''Remove-Item $ env:LOCALAPPDATA \ temp -recurse -force''? – 4c74356b41

+0

不知道你問我那裏,我不想刪除臨時文件夾中的所有內容。必須是有選擇的 – user770022

+1

好吧,你至少可以把它們縮小到temp \ 2 -recurse temp3 \ -recurse temp4 \ -recurse ctxreceiverlogs -recurse – 4c74356b41

回答

0

也許

get-childitem -recurse -include CTXReceiverLogs*, *.ica, *.etl, *.tmp | remove-item -recurse -force 

當然你已經到include參數適應您的需求。