Windowsのログアウト(サインアウト)時にごみ箱を空にする
2356 ワード
容量にシビアなサービス
ディスク容量を増やす前、削れるところは削ること。クラウドサービスは増やしたら簡単に減らせない。
ログイン・アウト時、実行する仕組みはいろいろカスタム処理で愛用している。
グループポリシー
ユーザの構成→ポリシー→Windwosの設定→スクリプトーログイン->プロパティ(PowerShellスクリプト)
\{ADサーバ}\sysvol\hoge.local\scripts\RemoveItem-Recyclebin.ps1
スクリプト
RemoveItem-Recyclebin.ps1
function RemoveItem-Recyclebin {
$Shell = New-Object -ComObject Shell.Application;
$RecycleBin = $Shell.Namespace(0xA);
$RecycleBin.Items() | ForEach-Object { Remove-Item $_.Path -Recurse -Confirm:$false }
}
RemoveItem-Recyclebin
参考
RemoveItem-Recyclebin.ps1
function RemoveItem-Recyclebin {
$Shell = New-Object -ComObject Shell.Application;
$RecycleBin = $Shell.Namespace(0xA);
$RecycleBin.Items() | ForEach-Object { Remove-Item $_.Path -Recurse -Confirm:$false }
}
RemoveItem-Recyclebin
Author And Source
この問題について(Windowsのログアウト(サインアウト)時にごみ箱を空にする), 我々は、より多くの情報をここで見つけました https://qiita.com/mkawanee/items/83ea08c1f882f64df267著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .