我们最近开始在我的工作场所推出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