码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2016-11-11 19:28:39      阅读:1285      评论:0      收藏:0      [点我收藏+]

标签:object   系统   signature   原因   shu   http   import   type   div   

除非学习要求,还是建议使用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 :START
14 if "%tmpInput%"=="Y" goto :START
15 echo Canelled.
16 echo Press any key to exit...
17 pause>nul
18 goto :END
19 :START
20 echo (1/3) Config Service
21 echo - Automatic Audio Server
22 PowerShell /Command "&{Import-Module ServerManager}"
23 PowerShell /Command "&{Set-Service "Audiosrv" -StartupType Automatic}"
24 echo (2/3) Config Registry and GroupPolicy
25 echo - Shutdown without logon
26 REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ShutdownWithoutLogon /t REG_DWORD /d 1 /f>nul
27 echo - Disable Ctrl+Alt+Del
28 REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v DisableCAD /t REG_DWORD /d 1 /f>nul
29 echo - Disable Shutdown reason On
30 REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" /v ShutdownReasonOn /t REG_DWORD /d 0 /f>nul
31 echo - CPU Priority for Program
32 REG ADD HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl /v Win32PrioritySeparation /t REG_DWORD /d 38 /f>nul
33 echo - IE Security Policy
34 REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" /v IsInstalled /t REG_DWORD /d 0 /f>nul
35 REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" /v IsInstalled /t REG_DWORD /d 0 /f>nul
36 Rundll32 iesetup.dll, IEHardenLMSettings
37 Rundll32 iesetup.dll, IEHardenUser
38 Rundll32 iesetup.dll, IEHardenAdmin
39 echo - No autorun Server Manager
40 REG ADD HKLM\Software\Microsoft\ServerManager /v DoNotOpenServerManagerAtLogon /t REG_DWORD /d 1 /f>nul
41 echo - Disable Password complexity and Minimum password length
42 echo [version]>%gpfile%.inf
43 echo signature="$CHICAGO$">>%gpfile%.inf
44 echo [System Access]>>%gpfile%.inf
45 echo MinimumPasswordLength = 0 >>%gpfile%.inf
46 echo PasswordComplexity = 0 >>%gpfile%.inf
47 secedit /configure /db %gpfile%.sdb /cfg %gpfile%.inf /log %gpfile%.log>nul 2>nul
48 del %gpfile%.inf %gpfile%.sdb %gpfile%.log %gpfile%.jfm /f /q
49 echo - %currentuser%‘s Password nerver expires
50 wmic Path Win32_UserAccount Where Name="%currentuser%" Set PasswordExpires="FALSE">nul
51 echo   PasswordExpires List:
52 wmic useraccount get Name,PasswordExpires
53 echo (3/3) Config Windows Feature
54 echo - BitLocker
55 echo - Direct-Play
56 echo - Wireless-Networking
57 echo - qWave
58 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>nul
63 :END
64 popd

 

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

 

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

标签:object   系统   signature   原因   shu   http   import   type   div   

原文地址:http://www.cnblogs.com/Bob-wei/p/6055087.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!