├── Acceleration.Level.ps1 ├── LICENSE ├── README.md ├── Windows Server To Windows Desktop.bat └── demo.png /Acceleration.Level.ps1: -------------------------------------------------------------------------------- 1 | function WriteKey($File, $Key) 2 | { 3 | ECHO $Key >> $File; 4 | ECHO '"Acceleration.Level"=dword:00000000' >> $File; 5 | ECHO "" >> $File; 6 | } 7 | 8 | function Generate($File, $ControlSet) 9 | { 10 | $Item = Get-Item -Path "HKLM:\HARDWARE\DEVICEMAP\VIDEO"; 11 | $ValueNames = $Item.GetValueNames(); 12 | foreach($ValueName in $ValueNames) 13 | { 14 | if($ValueName.StartsWith("\Device\Video")) 15 | { 16 | $Value = $Item.GetValue($ValueName); 17 | if($Value.Length -gt 43) 18 | { 19 | $Guid = $Value.SubString($Value.Length - 43, 38); 20 | $ObjectNumber = $Value.SubString($Value.Length - 4); 21 | try 22 | { 23 | [System.Guid]::Parse($Guid); 24 | [System.Int32]::Parse($ObjectNumber); 25 | } 26 | catch 27 | { 28 | continue; 29 | } 30 | $Path = "HKLM:\SYSTEM\" + $ControlSet + "\Control\Video\" + $Guid + "\Video"; 31 | $Service = (Get-Item -Path $Path).GetValue("Service"); 32 | $Path = "HKLM:\SYSTEM\" + $ControlSet + "\Services\" + $Service; 33 | $ChildItems = Get-ChildItem -Path $Path; 34 | foreach($ChildItem in $ChildItems) 35 | { 36 | if($ChildItem.PSChildName.StartsWith("Device")) 37 | { 38 | $Key = "[" + $ChildItem.Name + "]"; 39 | WriteKey $File $Key; 40 | } 41 | } 42 | $Key = "[HKEY_LOCAL_MACHINE\SYSTEM\" + $ControlSet + "\Control\Video\" + $Guid + "\" + $ObjectNumber + "]"; 43 | WriteKey $File $Key; 44 | $Key = "[HKEY_LOCAL_MACHINE\SYSTEM\" + $ControlSet + "\Control\Video\" + $Guid + "\" + $ObjectNumber + "\Settings]"; 45 | WriteKey $File $Key; 46 | } 47 | } 48 | } 49 | $VideoControllers = Get-WmiObject -Class Win32_VideoController; 50 | foreach($VideoController in $VideoControllers) 51 | { 52 | $PnPEntities = Get-WmiObject -Class Win32_PnPEntity; 53 | foreach($PnPEntity in $PnPEntities) 54 | { 55 | if($PnPEntity.PNPDeviceID -eq $VideoController.PNPDeviceID) 56 | { 57 | $Path = "HKLM:\SYSTEM\" + $ControlSet + "\Control\Class\" + $PnPEntity.ClassGuid; 58 | $ChildItems = Get-ChildItem -Path $Path; 59 | foreach($ChildItem in $ChildItems) 60 | { 61 | try 62 | { 63 | [System.Int32]::Parse($ChildItem.PSChildName); 64 | } 65 | catch 66 | { 67 | continue; 68 | } 69 | $Key = "[" + $ChildItem.Name + "]"; 70 | WriteKey $File $Key; 71 | $Key = "[" + $ChildItem.Name + "\Settings]"; 72 | WriteKey $File $Key; 73 | } 74 | } 75 | } 76 | } 77 | } 78 | 79 | $File = "Acceleration.Level.reg"; 80 | New-Item $File -Type File -Force; 81 | ECHO "Windows Registry Editor Version 5.00" > $File; 82 | ECHO "" >> $File; 83 | Generate $File "ControlSet001"; 84 | Generate $File "ControlSet002"; 85 | Generate $File "CurrentControlSet"; 86 | TYPE $File; 87 | regedit.exe /s $File; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 m2nlight 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WindowsServerToWindowsDesktop 2 | 3 | A bat script to auto config Windows Server 2016 to "Windows Desktop" 4 | 5 | 6 | 7 | ## BAT Will Do: 8 | * Config Service 9 | - \[Automatic] Windows Audio 10 | - \[Automatic] Windows Audio Endpoint Builder 11 | - \[Manual] Windows Remote Management (WS-Management) 12 | 13 | * Config Registry and GroupPolicy 14 | - Enable Shutdown without logon 15 | - Disable Shutdown reason On 16 | - ~~No Lock Screen~~ 17 | - Disable Ctrl+Alt+Del login 18 | - Disable UAC 19 | - Disable DEP (Turn on DEP for essential Windows programs and services only) 20 | - Disable SEHOP 21 | - Enable disk performance counters 22 | - Enable Video Hardware Acceleration ([Thanks @cjrcl](https://forums.mydigitallife.net/threads/poweshell-script-enabling-gfx-hw-acceleration-in-windows-server-2016.72294/)) 23 | - Enable Audio Hardware Acceleration 24 | - CPU Priority for Program 25 | - Adjust Visual Effects (Manual) 26 | - Adjust IE MaxConnection 27 | - IE Security Policy 28 | - Disable TCP Auto-Tuning 29 | - Change Power Scheme To High Performance 30 | - No Autorun Server Manager 31 | - Disable Password complexity and Minimum password length 32 | - Current user Password never expires 33 | - Disable Application Experience task schedulers 34 | - Disable Customer Experience Improvement Program task schedulers 35 | 36 | * Config Windows Feature 37 | - BitLocker 38 | - Direct-Play 39 | - Wireless-Networking 40 | - qWave 41 | 42 | ## Manual configuration 43 | 1. You can close Windows Defender in Windows Settings -> Update and Security - Windows Defender 44 | 2. Install Flash player use [install_flash_player_ax.exe](http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ax.exe) with Windows 7 compatibility mode on file property dialog. 45 | 3. Install Graphics drivers and DirectX etc. 46 | 47 | ## About Docker in Windows Server 2016 48 | Please read [this blog](https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/). 49 | -------------------------------------------------------------------------------- /Windows Server To Windows Desktop.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | PATH="%SYSTEMROOT%\system32";%PATH% 3 | pushd %~dp0 4 | set gpfile=temp_gpfile 5 | set currentuser=%username% 6 | set videopsfile=Acceleration.Level.ps1 7 | rem UAC code begin 8 | set getadminfile=getadmin.vbs 9 | echo Windows Server To Windows Desktop 10 | echo ================================= 11 | echo Starting 12 | "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\SYSTEM" >nul 2>nul 13 | if %ERRORLEVEL% EQU 0 ( 14 | goto :Admin 15 | ) else ( 16 | if %ERRORLEVEL% EQU 2 ( 17 | goto :PathErr 18 | ) else ( 19 | goto :UAC 20 | ) 21 | ) 22 | :PathErr 23 | echo. 24 | echo Please open "%~n0%~x0" by explorer.exe 25 | echo. 26 | echo Press any key to explore the folder... 27 | pause>nul 28 | start "" "%SYSTEMROOT%\system32\explorer.exe" /select,"%~f0" 29 | goto :END 30 | :UAC 31 | echo Set sh = CreateObject^("Shell.Application"^) > %getadminfile% 32 | echo sh.ShellExecute "%~f0", "", "", "runas", 1 >> %getadminfile% 33 | ping 127.1 -n 1 >nul 34 | "%SYSTEMROOT%\system32\cscript.exe" %getadminfile% 35 | goto :END 36 | :Admin 37 | if exist %getadminfile% ( del %getadminfile% ) 38 | cls 39 | rem UAC code end 40 | if "%currentuser%" == "" set currentuser=Administrator 41 | echo Windows Server To Windows Desktop 42 | echo ================================= 43 | ::PowerShell /Command "&{Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty Caption}" 44 | set caption= 45 | for /f "skip=1 delims=" %%t in ('wmic os get caption') do ( 46 | if not defined caption set caption=%%t 47 | ) 48 | echo %caption% 49 | echo %caption%|find /i "Windows Server">nul 2>nul 50 | if ERRORLEVEL 1 goto :OSERR 51 | echo Current Domain: %USERDOMAIN% 52 | echo Current User: %currentuser% 53 | echo. 54 | set /p tmpInput=Maybe will restart computer. Are you ready? (Y/N): 55 | if /i "%tmpInput%"=="y" goto :START 56 | echo Canelled. 57 | echo Press any key to exit... 58 | pause>nul 59 | goto :END 60 | :OSERR 61 | echo. 62 | echo ERROR: Unsupported operating system! 63 | echo Press any key to exit... 64 | pause>nul 65 | goto :END 66 | :START 67 | echo (1/3) Config Service 68 | PowerShell /Command "&{Import-Module ServerManager}" 69 | echo - [Automatic] Windows Audio 70 | PowerShell /Command "&{Set-Service "Audiosrv" -StartupType Automatic}" 71 | echo - [Automatic] Windows Audio Endpoint Builder 72 | PowerShell /Command "&{Set-Service "AudioEndpointBuilder" -StartupType Automatic}" 73 | echo - [Manual] Windows Remote Management (WS-Management) 74 | PowerShell /Command "&{Set-Service "WinRM" -StartupType Manual}" 75 | echo (2/3) Config Registry and GroupPolicy 76 | echo - Enable Shutdown without logon 77 | REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ShutdownWithoutLogon /t REG_DWORD /d 1 /f>nul 78 | echo - Disable Shutdown reason On 79 | REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" /v ShutdownReasonOn /t REG_DWORD /d 0 /f>nul 80 | :: echo - No Lock Screen 81 | :: reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v "NoLockScreen" /t REG_DWORD /d 0x1 /f>nul 82 | echo - Disable Ctrl+Alt+Del login 83 | REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v DisableCAD /t REG_DWORD /d 1 /f>nul 84 | echo - Disable UAC 85 | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d 0x0 /f>nul 86 | echo - Disable DEP (Turn on DEP for essential Windows programs and services only) 87 | bcdedit /set {current} nx OptIn>nul 88 | ::bcdedit /set {current} nx AlwaysOff>nul 89 | echo - Disable SEHOP 90 | reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "DisableExceptionChainValidation" /t REG_DWORD /d 0x1 /f>nul 91 | echo - Enable disk performance counters 92 | diskperf -Y>nul 93 | if exist %videopsfile%. ( 94 | echo - Enable Video Hardware Acceleration 95 | PowerShell -ExecutionPolicy Unrestricted -File %videopsfile%>nul 96 | del Acceleration.Level.reg /f /q 97 | ) 98 | echo - Enable Audio Hardware Acceleration 99 | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "SystemResponsiveness" /t REG_DWORD /d 0x14 /f>nul 100 | echo - CPU Priority for Program 101 | REG ADD HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl /v Win32PrioritySeparation /t REG_DWORD /d 38 /f>nul 102 | echo - Adjust Visual Effects (Manual) 103 | SystemPropertiesPerformance.exe 104 | ::reg add HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects /v VisualFXSetting /t REG_DWORD /d 1 /f>nul 105 | ::reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects /v VisualFXSetting /t REG_DWORD /d 1 /f>nul 106 | ::reg add "HKCU\Control Panel\Desktop" /v DragFullWindows /t REG_SZ /d 1 /f>nul 107 | ::reg add "HKCU\Control Panel\Desktop" /v FontSmoothing /t REG_SZ /d 2 /f>nul 108 | ::reg add "HKCU\Control Panel\Desktop" /v MinAnimate /t REG_SZ /d 1 /f>nul 109 | ::reg add "HKCU\Control Panel\Desktop" /v UserPreferencesMask /t REG_BINARY /d 9E3E078012000000 /f>nul 110 | echo - Adjust IE Max Connection 111 | reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "MaxConnectionsPer1_0Server" /t REG_DWORD /d 10 /f>nul 112 | echo - IE Security Policy 113 | REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" /v IsInstalled /t REG_DWORD /d 0 /f>nul 114 | REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" /v IsInstalled /t REG_DWORD /d 0 /f>nul 115 | Rundll32 iesetup.dll, IEHardenLMSettings 116 | Rundll32 iesetup.dll, IEHardenUser 117 | Rundll32 iesetup.dll, IEHardenAdmin 118 | echo - Disable TCP Auto-Tuning 119 | netsh interface tcp set heuristics disabled>nul 120 | echo - Change Power Scheme To High Performance 121 | powercfg -s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c>nul 122 | echo - No Autorun Server Manager 123 | REG ADD HKLM\Software\Microsoft\ServerManager /v DoNotOpenServerManagerAtLogon /t REG_DWORD /d 1 /f>nul 124 | echo - Disable Password complexity and Minimum password length 125 | echo [version]>%gpfile%.inf 126 | echo signature="$CHICAGO$">>%gpfile%.inf 127 | echo [System Access]>>%gpfile%.inf 128 | echo MinimumPasswordLength = 0 >>%gpfile%.inf 129 | echo PasswordComplexity = 0 >>%gpfile%.inf 130 | secedit /configure /db %gpfile%.sdb /cfg %gpfile%.inf /log %gpfile%.log>nul 2>nul 131 | del %gpfile%.inf %gpfile%.sdb %gpfile%.log %gpfile%.jfm /f /q 132 | echo - %currentuser%'s Password never expires 133 | wmic Path Win32_UserAccount Where Name="%currentuser%" Set PasswordExpires="FALSE">nul 134 | echo PasswordExpires List: 135 | wmic useraccount get Name,PasswordExpires 136 | echo - Disable Application Experience task schedulers 137 | schtasks /change /tn "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /disable>nul 2>nul 138 | schtasks /change /tn "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /disable>nul 2>nul 139 | schtasks /change /tn "\Microsoft\Windows\Application Experience\StartupAppTask" /disable>nul 2>nul 140 | echo - Disable Customer Experience Improvement Program task schedulers 141 | schtasks /change /tn "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator" /disable>nul 2>nul 142 | schtasks /change /tn "\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask" /disable>nul 2>nul 143 | schtasks /change /tn "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" /disable>nul 2>nul 144 | echo (3/3) Config Windows Feature 145 | echo - BitLocker 146 | echo - Direct-Play 147 | echo - Wireless-Networking 148 | echo - qWave 149 | echo please wait... 150 | PowerShell /Command "&{Install-WindowsFeature "BitLocker","Direct-Play","Wireless-Networking","qWave" -Restart}" 151 | echo Completed! 152 | echo Press any key to exit... 153 | pause>nul 154 | :END 155 | if exist %getadminfile% ( del %getadminfile% ) 156 | popd 157 | -------------------------------------------------------------------------------- /demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m2nlight/WindowsServerToWindowsDesktop/1f0ef831eec6ccf2020094795a5d16453ebe0025/demo.png --------------------------------------------------------------------------------