locked
changing multiple registry entries, VBScript RRS feed

  • Question

  • I'm trying to figure out the correct way to change multiple registry keys through a script.  Here is what I have so far.  I'm thinking that I may have to put a loop in for it, however I'm to new to scripting to really know what the proper way is.

    Thanks again.

    const HKEY_LOCAL_MACHINE = &H80000002
    
    strComputer = "."
    
    Set StdOut = WScript.StdOut
     Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")
    strKeyPath = "SYSTEM\CurrentControlSet\control\lsa"
    strValueName = "forceguest"
    dwValue = 0
    
    strKeyPath = "SYSTEM\CurrentControlSet\control\lsa"
    strValueName = "LimitBlankPasswordUse"
    dwValue =0
    
    strKeyPath = "SYSTEM\CurrentControlSet001\control\lsa"
    strValueName = "LimitBlankPasswordUse"
    dwValue =0
    
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

    Thanks, Josh ô¿ô
    Wednesday, June 24, 2009 6:26 PM

Answers

  • Try this:

    const HKEY_LOCAL_MACHINE = &H80000002
    
    strComputer = "."
    
    Set StdOut = WScript.StdOut
     Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")
    strKeyPath = "SYSTEM\CurrentControlSet\control\lsa"
    strValueName = "forceguest"
    dwValue = 0
    
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    
    strKeyPath = "SYSTEM\CurrentControlSet\control\lsa"
    strValueName = "LimitBlankPasswordUse"
    dwValue =0
    
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    
    strKeyPath = "SYSTEM\CurrentControlSet001\control\lsa"
    strValueName = "LimitBlankPasswordUse"
    dwValue =0
    
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    
    • Proposed as answer by perhof Wednesday, June 24, 2009 6:39 PM
    • Marked as answer by Josh Royle Wednesday, June 24, 2009 6:57 PM
    Wednesday, June 24, 2009 6:38 PM

All replies

  • Try this:

    const HKEY_LOCAL_MACHINE = &H80000002
    
    strComputer = "."
    
    Set StdOut = WScript.StdOut
     Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")
    strKeyPath = "SYSTEM\CurrentControlSet\control\lsa"
    strValueName = "forceguest"
    dwValue = 0
    
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    
    strKeyPath = "SYSTEM\CurrentControlSet\control\lsa"
    strValueName = "LimitBlankPasswordUse"
    dwValue =0
    
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    
    strKeyPath = "SYSTEM\CurrentControlSet001\control\lsa"
    strValueName = "LimitBlankPasswordUse"
    dwValue =0
    
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    
    • Proposed as answer by perhof Wednesday, June 24, 2009 6:39 PM
    • Marked as answer by Josh Royle Wednesday, June 24, 2009 6:57 PM
    Wednesday, June 24, 2009 6:38 PM
  • That makes sense.  Thanks for the help.

    Thanks, Josh ô¿ô
    Wednesday, June 24, 2009 6:58 PM