Category Archives: Operating systems

In my hunt for a way to optimize my new server 2012 build’s I ran across this blog post.

In the below post , she talks about using powershell to build a template for VMware ESXi / vSphere.

Below are some useful commands.

Windows Server 2012: VM template tuning using PowerShell

# Change Drive Letter on DVD Drive to X

gwmi Win32_Volume -Filter "DriveType = '5'" | swmi -Arguments @{DriveLetter = 'X:'}

# Initialize RAW disks

Get-Disk | Where-Object PartitionStyle –eq 'RAW' | Initialize-Disk –PartitionStyle MBR

# Format disk 0 for pagefile
# Verify correct disknumber before use

New-Partition –DiskNumber 0 -UseMaximumSize -AssignDriveLetter | Format-Volume -NewFileSystemLabel 'Pagefile' -FileSystem NTFS -AllocationUnitSize 65536 -Confirm:$false

# Disable Indexing on all drives

gwmi Win32_Volume -Filter "IndexingEnabled=$true" | swmi -Arguments @{IndexingEnabled=$false}

# Set location for dedicated dump file at system failure
# Verify correct path before use

Set-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlCrashControl' -Name 'DedicatedDumpFile' -Value 'D:MEMORY.DMP'
gwmi Win32_OSRecoveryConfiguration -EnableAllPrivileges | swmi -Arguments @{DebugFilePath='D:MEMORY.DMP'}

# Use small memory dump at system failure

gwmi Win32_OSRecoveryConfiguration -EnableAllPrivileges | swmi -Arguments @{DebugInfoType=1}

# Change setting to: Do not automatically restart at system failure

gwmi Win32_OSRecoveryConfiguration -EnableAllPrivileges | swmi -Arguments @{AutoReboot=$false}

# Turn off automatically manage paging file size for all drives

gwmi Win32_ComputerSystem -EnableAllPrivileges | swmi -Arguments @{AutomaticManagedPagefile=$false}

 Since I am at a basic level with powershell, I thought this was helpful to me.

What is everyone else doing?

  All Credit to Reidar Johansen

 Roger L