首页 > 代码库 > Windows Server 2016 桌面环境的自动配置脚本

Windows Server 2016 桌面环境的自动配置脚本

除非学习要求,还是建议使用Windows 10 LTSB 2016或其他桌面系统。

github:https://github.com/m2nlight/WindowsServerToWindowsDesktop

它的功能是自动启动音频服务、允许未登录关机、禁用Ctrl+Alt+Del登录系统、禁用关机时要求输入关机原因、CPU性能优秀程序、IE安全策略、登录时不现实服务器管理器、禁用密码混淆和长度要求、当前用户密码永不过期,安装Bitlocker、Direct-Play、无线网络、优质Windows音视频体验组件。

将脚本复制到桌面,并且要求管理员权限,去运行,输入y开始配置,会重新启动一次系统,演示效果如图:

技术分享

 

脚本如下:

 1 @echo off 2 pushd %~dp0 3 set gpfile=temp_gpfile 4 set currentuser=%username% 5 if "%currentuser%" == "" set currentuser=Administrator 6 echo Windows Server To Windows Desktop 7 echo ================================= 8 PowerShell /Command "&{Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty Caption}" 9 echo Current Domain: %USERDOMAIN%10 echo Current User: %currentuser%11 echo.12 set /p tmpInput=Maybe will restart computer. Are you ready? (Y/N):13 if "%tmpInput%"=="y" goto :START14 if "%tmpInput%"=="Y" goto :START15 echo Canelled.16 echo Press any key to exit...17 pause>nul18 goto :END19 :START20 echo (1/3) Config Service21 echo - Automatic Audio Server22 PowerShell /Command "&{Import-Module ServerManager}"23 PowerShell /Command "&{Set-Service "Audiosrv" -StartupType Automatic}"24 echo (2/3) Config Registry and GroupPolicy25 echo - Shutdown without logon26 REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ShutdownWithoutLogon /t REG_DWORD /d 1 /f>nul27 echo - Disable Ctrl+Alt+Del28 REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v DisableCAD /t REG_DWORD /d 1 /f>nul29 echo - Disable Shutdown reason On30 REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" /v ShutdownReasonOn /t REG_DWORD /d 0 /f>nul31 echo - CPU Priority for Program32 REG ADD HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl /v Win32PrioritySeparation /t REG_DWORD /d 38 /f>nul33 echo - IE Security Policy34 REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" /v IsInstalled /t REG_DWORD /d 0 /f>nul35 REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" /v IsInstalled /t REG_DWORD /d 0 /f>nul36 Rundll32 iesetup.dll, IEHardenLMSettings37 Rundll32 iesetup.dll, IEHardenUser38 Rundll32 iesetup.dll, IEHardenAdmin39 echo - No autorun Server Manager40 REG ADD HKLM\Software\Microsoft\ServerManager /v DoNotOpenServerManagerAtLogon /t REG_DWORD /d 1 /f>nul41 echo - Disable Password complexity and Minimum password length42 echo [version]>%gpfile%.inf43 echo signature="$CHICAGO$">>%gpfile%.inf44 echo [System Access]>>%gpfile%.inf45 echo MinimumPasswordLength = 0 >>%gpfile%.inf46 echo PasswordComplexity = 0 >>%gpfile%.inf47 secedit /configure /db %gpfile%.sdb /cfg %gpfile%.inf /log %gpfile%.log>nul 2>nul48 del %gpfile%.inf %gpfile%.sdb %gpfile%.log %gpfile%.jfm /f /q49 echo - %currentuser%‘s Password nerver expires50 wmic Path Win32_UserAccount Where Name="%currentuser%" Set PasswordExpires="FALSE">nul51 echo   PasswordExpires List:52 wmic useraccount get Name,PasswordExpires53 echo (3/3) Config Windows Feature54 echo - BitLocker55 echo - Direct-Play56 echo - Wireless-Networking57 echo - qWave58 echo please wait...59 PowerShell /Command "&{Install-WindowsFeature "BitLocker","Direct-Play","Wireless-Networking","qWave" -Restart}"60 echo Completed!61 echo Press any key to exit...62 pause>nul63 :END64 popd

 

其他的手动配置:见github的readme。

 

Windows Server 2016 桌面环境的自动配置脚本