Glam Prestige Journal

Bright entertainment trends with youth appeal.

According to Microsoft, in Windows 10/8/7, to Turn Disk Write Caching On or Off:

  1. Right-click My Computer, and then click Properties.
  2. Click the Hardware tab, and then click Device Manager.
  3. Expand Disk Drives.
  4. Right-click the drive on which you want to turn disk write caching on or off, and then click Properties.
  5. Click the Policies tab.
  6. Click to select or clear the Enable write caching on the disk check box as appropriate.
  7. Click OK.

enter image description here

How can I Turn Disk Write Caching On or Off with a registry key (regedit) / command line? (to automate the process on several PCs)

PD: There is an option in C/C++, but it is outdated or not applicable. The same applies to the method used by dskcache.

8

2 Answers

It seems that an old diskcache.exe, which had been distributed by Microsoft, has been lost. Try a compatible tool, made by me long ago.

To enable write cache on disk 0,

.\diskcach 0 -w 1

To disable

.\diskcach 0 -w 0

It may require MSVC++ 2008 SP1 redistributable package.

3

I have created a function to enable/disable write disk caching for the system drive only. Restart needed.

Permanent link:

<# .SYNOPSIS Configure the disk write caching .PARAMETER Disable Disable the disk write caching .PARAMETER Enable Enable the disk write caching .EXAMPLE DiskWriteCaching -Disable .EXAMPLE DiskWriteCaching -Enable .NOTES Current user
#>
function DiskWriteCaching
{ param ( [Parameter( Mandatory = $true, ParameterSetName = "Disable" )] [switch] $Disable, [Parameter( Mandatory = $true, ParameterSetName = "Enable" )] [switch] $Enable ) # Get system drive ID regardless of the port number $Index = (Get-Partition | Where-Object -FilterScript {$_.DriveLetter -eq $env:SystemDrive[0]}).DiskNumber $SystemDriveID = (Get-CimInstance -ClassName CIM_DiskDrive | Where-Object -FilterScript {$_.Index -eq $Index}).PNPDeviceID # Get system drive instance $PSPath = (Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Enum\SCSI | Where-Object -FilterScript {$SystemDriveID -match $_.PSChildName}).PSPath # We need to go deeper... LeonardoDiCaprio.jpg $PSPath = (Get-ChildItem -Path $PSPath | Where-Object -FilterScript {$SystemDriveID -match $_.PSChildName}).PSPath # Check whether disk write caching is enabled $IsDeviceCacheEnabled = (Get-StorageAdvancedProperty -PhysicalDisk (Get-PhysicalDisk | Where-Object -FilterScript {$_.DeviceID -eq $Index})).IsDeviceCacheEnabled switch ($PSCmdlet.ParameterSetName) { "Disable" { if ($IsDeviceCacheEnabled) { if (-not (Test-Path -Path "$PSPath\Device Parameters\Disk")) { # Create "Disk" folder New-Item -Path "$PSPath\Device Parameters\Disk" -Force } # Disable disk write caching New-ItemProperty -Path "$PSPath\Device Parameters\Disk" -Name UserWriteCacheSetting -PropertyType DWord -Value 0 -Force New-ItemProperty -Path "$PSPath\Device Parameters\Disk" -Name CacheIsPowerProtected -PropertyType DWord -Value 0 -Force } } "Enable" { if (-not $IsDeviceCacheEnabled) { if (-not (Test-Path -Path "$PSPath\Device Parameters\Disk")) { # Create "Disk" folder New-Item -Path "$PSPath\Device Parameters\Disk" -Force } # Enable disk write caching New-ItemProperty -Path "$PSPath\Device Parameters\Disk" -Name UserWriteCacheSetting -PropertyType DWord -Value 1 -Force New-ItemProperty -Path "$PSPath\Device Parameters\Disk" -Name CacheIsPowerProtected -PropertyType DWord -Value 0 -Force } } } Write-Warning "Make sure to restart your PC!"
}
# DiskWriteCaching -Disable
# DiskWriteCaching -Enable
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy