none
Powershell script is not able to set required CUSTOM Windows visual settings RRS feed

  • Question

  • I want below settings in Visual Effect performance settings using CUSTOM option via Powershell script: 

    Required Settings

    This should be work for both Windows 10 and Windows 7. Below is my code to set the setting:

    $OsMajorVersion = [System.Environment]::OSVersion.Version.Major
    $OsMinorVersion = [System.Environment]::OSVersion.Version.Minor
    
    $DisableVisualEffectStatus=Get-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -ErrorAction SilentlyContinue
    
    if($visualfxsetting -eq $null)
    {
    	New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -Value 2 -PropertyType "DWord" 
    }
    else
    {
    	Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -Value 2
    }
    Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -Value 3
    
    if($OsMajorVersion -eq 10)
    {
        if($OsMinorVersion -ge 0)
        {
    #If win 10 
    		Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x90,0x32,0x07,0x80,0x10,0x00,0x00,0x00))
    	}
    }
    else
    {
    #if win 7
    	Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x90,0x20,0x05,0x80,0x10,0x00,0x00,0x00))
    }


    I executed the script successfully and to get the updated changes I restarted/rebooted the Machine. 
    After restart, I observed the require settings get checked in CUSTOM but some other unwanted settings also got checked after reboot ( for this please see below setting screenshot:) 

    Unnecessary/unwanted settings got checked

    Why those unwanted/unnecessary settings got checked after reboot?

    Am I missing any "UserPreferenceMask" binary combination? If not, is there any other way to set the only necessary/require Visual effect setting(not unnecessary ones) using Powershell? Or additionally I have to do anything inside Powershell script to set the Visual effect require settings that would not be changed even after System reboot? 

    
    Thursday, December 27, 2018 10:24 AM

All replies

  • You are changing multiple registry settings in your script, can you execute 1 - reboot and check the changes.

    Move onto next change and reboot and check the changes. Get down to exactly what one is making the other  changes to occur. 

    Thursday, December 27, 2018 7:59 PM