我們最近開始在我的工作場所推出2016盒子,現在我正在經歷的部分流程是儘可能使用戶配置文件爲「用戶友好」。文件夾刪除批處理文件導致的意外結果服務器2016
正如你可能知道的Server 2016有Windows 10的開始菜單配置,不幸的是,我的特殊情況,使管理工具,PowerShell等非常容易得到爲我們的客戶誰將無法運行它們,但我想避免可能的負面印象/誤解的服務器有問題,他們可能會有,如果他們嘗試運行任何這些快捷方式,所以... ...
我想獲得一個批處理文件一起,我可以運行或者作爲每個用戶登錄或從我自己的域管理員配置文件登錄,並從包含這些快捷方式的appdata漫遊和appdata本地刪除文件夾....我不想刪除我的同胞域管理員快捷方式只有客戶端的。
這是我到目前爲止沒有完美工作..我已經從我遇到的各種腳本拼湊在一起,因爲我對這些編碼相對缺乏經驗....在我的測試環境中,它正在影響多個配置文件,雖然我沒有意識到它會去,它真的只爲WinX快捷方式文件夾工作...它正在刪除,但其他文件夾保持....
任何幫助在解密我的無能將不勝感激..
@ECHO OFF
:START
cls
cd %USERPROFILE%
cd..
set profiles=%cd%
for /f "tokens=* delims= " %%u in ('dir /b/ad') do (
cls
title Removing %%u Unnecessary shortcuts from roaming. . .
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows System" echo Deleting....
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows System" cd "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows System"
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows System" del *.* /F /S /Q /A: R /A: H /A: A
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows System" rmdir /s /q "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows System"
cls
title Removing %%u More unnecessary shortcuts from roaming. . .
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" echo Deleting....
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" cd "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools"
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" del *.* /F /S /Q /A: R /A: H /A: A
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" rmdir /s /q "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools"
cls
title Removing %%u Even more unnecessary shortcuts from roaming. . .
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell" echo Deleting....
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell" cd "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell"
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell" del *.* /F /S /Q /A: R /A: H /A: A
if exist "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell" rmdir /s /q "%profiles%\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell"
cls
title Removing %%u Unnecessary shortcuts from WinX Menu. . .
if exist "%profiles%\%%u\AppData\Local\Microsoft\Windows\WinX\Group3" echo Deleting....
if exist "%profiles%\%%u\AppData\Local\Microsoft\Windows\WinX\Group3" cd "%profiles%\%%u\AppData\Local\Microsoft\Windows\WinX\Group3"
if exist "%profiles%\%%u\AppData\Local\Microsoft\Windows\WinX\Group3" del *.* /F /S /Q /A: R /A: H /A: A
if exist "%profiles%\%%u\AppData\Local\Microsoft\Windows\WinX\Group3" rmdir /s /q "%profiles%\%%u\AppData\Local\Microsoft\Windows\WinX\Group3"
)
cls
goto END
:END
exit
你的代碼亂七八糟。請[編輯]正確格式化。如果你不確定如何,點擊?在文本區域的右上角之上並閱讀所提供的信息。另外,FWIW,你的方法是完全錯誤的。您應該使用組策略來代替;它會爲非管理員用戶刪除菜單項,而不會手動刪除任何內容。它也會使這些菜單項可供管理員再次自動使用。 –
使用組策略方法闡明問題:已經制定了防止用戶能夠運行這些快捷方式的策略。它不會做的是將它們從可見性中刪除/從開始解除它們。我必須從開始手動取消固定並手動進入,並更改包含快捷方式的文件夾上的NTFS權限,或刪除它們以便能夠提供我正在爭取給客戶端的環境。正如您可以想象的,每臺服務器上有30多個用戶需要花費大量時間。 – therealslimbrady
你們是否都只是對我的問題投反對票,因爲你沒有答案或者是什麼問題? – therealslimbrady