Setting graphics hardware acceleration in Windows

For the past few weeks I have been trying to find a programmatic way to set the graphics hardware acceleration in Windows. I needed to do this because I have been trying to install Vision at work, and there are problems drawing graphics on some computers after the installation.

Now, I know that changing the acceleration is as easy as adjusting a slider in the Advanced settings of the Display properties. However, I want to make the change without having to use the GUI. My reason for not wanting to use the GUI is that I need to be able to set the acceleration on multiple computers via Ghost. I mistakenly thought that something like this had to have been done by someone, so I started searching for how it was done.

After a couple of days of searching using various keywords, I finally found something on Experts Exchange. From a programming PAQ, I discovered that there is a DWORD called Acceleration.Level that determines the hardware acceleration level of a video card. If the acceleration level is set to the default, which is full acceleration, Acceleration.Level may not be in the Registry.

I was pretty excited, thinking that I would be able to just script this into a Ghost AI package. My excitement soon turned to disappointment when I looked at the Registry on a different model computer. There was a different GUID in the path to Acceleration.Level. So, in order to set the acceleration in the Registry, you have to know the GUID of the video card.

I figured that would be an easy enough thing to do: have the AI package read the value of \Device\Video0 at HKLM\HARDWARE\DEVICEMAP\VIDEO in the Registry. Replacing the "\Registry\Machine\" from the beginning of the value with "HKLM\HARDWARE\" should be easy enough, right? Wrong.

To top off my previous disappointment, I found that Ghost AI Builder does not allow you to dynamically read values from the Registry. So, in order to cover all of our machines, I will need to make a separate AI package (or at least a separate code block within an AI package) to set the hardware acceleration for each video card we have deployed. Ugh!

If anyone has any better ideas, I’m all ears. Remember, I need to be able to deploy this via Ghost. I do not have a Windows domain available to me, and I probably won’t be able to use any Novell methods to deploy this.

9 Responses to “Setting graphics hardware acceleration in Windows”


  1. 1 Emmanuel

    So, was this on Windows 2000 or XP? I’m working on a similar issue due to eTalk Qfiniti needing to disable hardware acceleration. But I’m running with only Windows 2000, I can’t find Acceleration.Level anywhere in the 2k registry - even on a machine where I’ve changed the Acceleration level.

    I’ve looked in those spots in the registry you pointed out, but can’t find anything that appears related…

    Any ideas for me?

  2. 2 Mark

    @Emmanuel: This was on Windows XP. I do not know if this setting is available on 2000, but your experience leads me to believe it is not. I’ll see if I can find anything, but I’ve been too busy to even write a blog post more than once a week lately. Keep checking back, or subscribe to the comments for my blog.

  3. 3 Emanuele

    I’ve made a commandline utility for switching on/off the hardware acceleration instead of the 11 clicks…

    http://www.teslacore.it/wiki/index.php?title=HWAccelSwitch

    Thanks for the hint!

  4. 4 Jake

    Got it.

    “Acceleration.Level”=dword:00000001 (1-5) shows up where it is supposed to be in Windows 2000 as long as Hardware acceleration is not set to FULL. At least it worked in my test against an ESX VM guest.

    If it does not for you, then try (on a test machine) creating the key in its expected location, setting the DWORD value to 0. Sorry I didn’t have a test W2K server to try on my own.

  5. 5 DigiMahn

    You could try this (it would happen first user logs on):

    Create a VBScript…
    1. copies %windir%\System32\usrlogon.cmd to %windir%\System32\usrlogon.tmp
    2. Reads your value from HKLM\HARDWARE\DEVICEMAP\VIDEO
    3. Replaces the string accordingly (5 = None, 0 = Full)
    4. Creates a new .REG file accordingly
    5. Runs regedit /s to set

    Now open %WINDIR%\System32\usrlogn.cmd…
    (Assuming you have never touched the local sysstem logon script before this will work, but you will have to adjust to your needs if you have made changes already)
    1. First line should be @Echo Off and set a command to run your VBscript and wait for it to return control to the O/S before continuing - something like:

    START /MIN /WAIT “cscript //b \SETACCEL.vbs”

    (you only need the quotes around the cscript command if your path contains a space or a comma)

    Now there’s more than one way to keep this from happening everytime a user logs on from here on out…but this is how I would handle it:

    Use the HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce to start a batch file that deletes usrlogon.cmd and then renames usrlogon.tmp to usrlogon.cmd and now everything is back to normal:

    RunOnce key in registry runs once…kind of intuitive
    (use a string value like accellsetup and then set its value to “:\\batch.bat” and be sure to include the quotes)

    You seem a bit smarter about all this than me, but if you want help send me an email (I had to leave an addy with this post…hope you can see it).

  6. 6 DigiMahn

    that last comment is missing drive and path information in the runonce information - I hope anyone reading it realizes that.

    Did not realize that was going to happen…

  7. 7 DigiMahn

    This script ought to do it, but you should know that on Windows Server 2003 the value for Acceleration.Level gets set to 0 for Full Acceleration and in Windows XP the Accelleration.Level is Deleted.

    I tested setting the value to 0 and leaving it in XP’s registry and all seemed OK, but I would recommend a log off at least and a restart at best…I know it’s an old topic but I am hoping someone out there needs the help!

    use copy & paste to notepad to ditch the width limits of this blog.

    Const HKEY_LOCAL_MACHINE = &H80000002

    sComputer = “.”
    sMethod = “GetStringValue”
    hTree = HKEY_LOCAL_MACHINE
    sKey = “HARDWARE\DEVICEMAP\VIDEO”
    sValue = “\Device\Video0″

    Set oRegistry = GetObject(”winmgmts:{impersonationLevel=impersonate}//” & sComputer & “/root/default:StdRegProv”)

    Set oMethod = oRegistry.Methods_(sMethod)
    Set oInParam = oMethod.inParameters.SpawnInstance_()

    oInParam.hDefKey = hTree
    oInParam.sSubKeyName = sKey
    oInParam.sValueName = sValue

    Set oOutParam = oRegistry.ExecMethod_(sMethod, oInParam)
    strParse = oOutParam.Properties_(”sValue”)

    ‘* In Windows XP Delete the Accelleration.Level altogether
    ‘* In Windows Server 2003 Change the DWORD value for Accelleration.Level from 0 (none) to 5 (full)

    sMethod = “SetDWordValue”
    hTree = HKEY_LOCAL_MACHINE
    sKey = Replace(strParse, “\Registry\Machine\”, “”)
    sValueName = “Acceleration.Level”
    uValue = 0

    Set oRegistry = GetObject(”winmgmts:{impersonationLevel=impersonate}//” & sComputer & “/root/default:StdRegProv”)
    Set oMethod = oRegistry.Methods_(sMethod)
    Set oInParam = oMethod.inParameters.SpawnInstance_()

    oInParam.hDefKey = hTree
    oInParam.sSubKeyName = sKey
    oInParam.sValueName = sValueName
    oInParam.uValue = uValue

    Set oOutParam = oRegistry.ExecMethod_(sMethod, oInParam)

    sComputer = Empty
    sMethod = Empty
    hTree = Empty
    sKey = Empty
    sValue = Empty
    sValueName = Empty
    uValue = Empty
    Set oRegistry = Nothing
    Set oMethod = Nothing
    Set oInParam = Nothing
    Set oOutParam = Nothing

    WScript.Quit

  8. 8 Chris

    Wow thats a lot of code.

    Dim RegValueData
    Set objReg=GetObject(”winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv”)
    objReg.GetStringValue &H80000002,”HARDWARE\DEVICEMAP\VIDEO”,”\Device\Video0″,RegValueData
    objReg.SetDWORDValue &H80000002,Right(RegValueData, 82),”Acceleration.Level”,0

  9. 9 Rob

    Chris… This works fantastic

Leave a Reply

Note: This post is over 2 years old. You may want to check later in this blog to see if there is new information relevant to your comment.