以前桌面部署也遇到这种问题,有时候满屏都是乱78糟的文件,所以禁止用户对桌面进行写操作,效果很好很清爽
::Disable write to Desktop
rem %systemroot%\system32\cacls.exe "%userprofile%\桌面" /t /e /p admin:R
%systemroot%\system32\cacls.exe "%userprofile%\桌面" /t /e /p administrators:R
%systemroot%\system32\cacls.exe "%userprofile%\桌面" /t /e /p onlyit:R
rem %systemroot%\system32\cacls.exe "%userprofile%\桌面" /t /e /p only:R
%systemroot%\system32\cacls.exe "%userprofile%\桌面" /t /e /p everyone:R
rem %systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p admin:R
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p administrators:R
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p onlyit:R
rem %systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p only:R
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p everyone:R
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p "Power Users":R
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p Users:R
这种方式还是保留了system帐户对桌面的写操作,所以有时候还要借助psexec对一些非保留图标进行清除
..\psexec.exe -accepteula @..\only.txt -u onlyit -p "" -c -n 5 lnk.cmd
lnk.cmd
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p administrators:f
%systemroot%\system32\cacls.exe "%userprofile%\桌面" /t /e /p onlyit:F
for /f "delims=" %%a in ('dir /a /b "%allusersprofile%\桌面\*"') do if /i not "%%a" =="ACDsee.lnk" if /i not "%%a" =="drivers.lnk" if /i not "%%a" =="OA题苑+练习.exe" if /i not "%%a" =="学生.lnk" if /i not "%%a" =="教师.lnk" if /i not "%%a" =="移除U盘.exe" if /i not "%%a" =="自动关机.lnk" if /i not "%%a" =="解除自动关机.lnk" rd /q /s "%allusersprofile%\桌面\%%a" || del /s /q /f "%allusersprofile%\桌面\%%a"
for /f "delims=" %%a in ('dir /a /b "%userprofile%\桌面\*"') do if /i not "%%a" =="pif" if /i not "%%a" =="自动关机.lnk" if /i not "%%a" =="a.cmd" rd /q /s "%userprofile%\桌面\%%a" || del /s /q /f "%userprofile%\桌面\%%a"
%systemroot%\system32\cacls.exe "%userprofile%\桌面" /t /e /p onlyit:R
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p administrators:R
其它已知问题,由于有些软件需要向桌面写图标操作,如果不成功就意外中止,很笨吧这些软件,哈哈所以需要在安装时开启桌面写操作,安装完毕关闭就行了
@echo off
call :quiet>nul 2>&1
goto :EOF
:quiet
title 安装netbeans完毕后按任意键继续
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p administrators:f
pause
%systemroot%\system32\cacls.exe "%allusersprofile%\桌面" /t /e /p administrators:r
[
Last edited by dato on 2008-10-29 at 13:12 ]