Set Visual effects to “Adjust for best Performance” using Powershell DSC

I am trying to set the Visual effects to “adjust to best performance” to optimize the OS performance.I am using Powershell DSC configuration which referring registry resource and applying this configuration.

Before creating the configuration file, i am running powershell commands for testing purpose.I am running the following commands

[pre]

PS C:\WINDOWS\system32> $path = ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects’

PS C:\WINDOWS\system32> $s = (Get-ItemProperty -ErrorAction stop -Name visualfxsetting -Path $path).visualfxsetting

[/pre]

I am getting the following error:

[pre]

Get-ItemProperty : Property visualfxsetting does not exist at path HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects.
At line:1 char:7

  • $s = (Get-ItemProperty -ErrorAction stop -Name visualfxsetting -Path …
  • CategoryInfo : InvalidArgument: (visualfxsetting:String) [Get-ItemProperty], PSArgumentException
  • FullyQualifiedErrorId : System.Management.Automation.PSArgumentException,Microsoft.PowerShell.Commands.GetItemPropertyCommand

[/pre]

When i look in the registry editor, there is no key named visualfxsetting under VisualEffects and no value set.

Does this mean first i have to create a registry key and value and then use it to apply the configuration? If so what type of registry key i have to create and what value i have to set?

https://stackoverflow.com/questions/55019693/visual-effects-set-to-adjust-for-best-performance-using-powershell-dsc