Created
January 29, 2016 11:07
-
-
Save kapb14/8f308a80d78f529e6780 to your computer and use it in GitHub Desktop.
This is a list of commands that I use when setting up a Windows Server 2012 Core template (can also be used for GUI template). I run all of these commands in PowerShell, either as a script or manually. In server core you start PowerShell by typing powershell.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| ## ВСЕ ДЕЙСТВИЯ ВЫПОЛНЯЮТСЯ В powershell.exe ИЗ ПОД АДМИНИСТРАТОРА! | |
| ## | |
| # Change Drive Letter on DVD Drive to E: | |
| gwmi Win32_Volume -Filter "DriveType = '5'" | swmi -Arguments @{DriveLetter = 'E:'} | |
| # Set Power plan to High performance | |
| powercfg.exe /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c | |
| # Disable the hibernate feature | |
| powercfg.exe /HIBERNATE off | |
| # Set Password Never Expires on the local Administrator account | |
| gwmi Win32_UserAccount -Filter "name = 'Administrator'" | swmi -Arguments @{PasswordExpires = 0} | |
| # Initialize RAW disks | |
| Get-Disk | Where-Object PartitionStyle –eq 'RAW' | Initialize-Disk –PartitionStyle MBR | |
| # Disable Indexing on all drives | |
| gwmi Win32_Volume -Filter "IndexingEnabled=$true" | swmi -Arguments @{IndexingEnabled=$false} | |
| # Turn off automatically manage paging file size for all drives | |
| gwmi Win32_ComputerSystem -EnableAllPrivileges | swmi -Arguments @{AutomaticManagedPagefile=$false} | |
| # Allow all MMC snap-ins to connect from remote | |
| Enable-NetFirewallRule -DisplayGroup 'Windows Remote Management' | |
| # Enable Remote Desktop for Administration mode to accept connections | |
| cscript C:\Windows\System32\Scregedit.wsf /ar 0 | |
| # Allow server response to Ping | |
| netsh firewall set icmpsetting 8 | |
| # Turn off DHCP on Ethernet Interface | |
| # _Verify InterfaceAlias_ | |
| Set-NetIPInterface -InterfaceAlias Ethernet -Dhcp Disabled | |
| # Install Windows Updates, reboot and repeat until no updates exist - alternative is to use sconfig | |
| cscript c:\Windows\System32\en-US\WUA_SearchDownloadInstall.vbs | |
| # Start Disk Optimization and Defrag all disks | |
| Get-Volume | Where-Object {$_.DriveType -eq 'Fixed'} | Optimize-Volume -Defrag | |
| # Zero out free space with SDelete (download it and copy to C:\Windows\System32) | |
| sdelete -z c: -accepteula | |
| # Remove static IP before creating a template from this VM | |
| $Adapter = Get-NetAdapter -Name Ethernet | |
| $Adapter | Set-NetIPInterface -Dhcp Enabled | |
| Remove-NetRoute -InterfaceAlias $Adapter.Name -Confirm:$false | |
| ipconfig /release | |
| ## | |
| ## [Source:](http://johansenreidar.blogspot.ru/2013/06/windows-server-2012-vm-template-tuning.html) | |
| ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment