locked
Reg key value changes using command line RRS feed

  • Question

  • I wrote a script below so that it would delete the reg key value of iexplorer and then recreate it, it seems that it just create a new iexplorer value under the key strings so when I push it out via group policy it has two iexplorers one with a value of 0 and one with a value of 1. Is their a way to just change the value of the regkey from a 1 to a 0 using reg  command line 

    :keyverify
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\esawebmailregkeychanges
    if %errorlevel%==1 (goto webmailkeychange) else (goto End)

    :webmailkeychange
    reg delete "HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_SNIFFING" /v "iexplorer.exe" /f

    reg delete "HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_handling" /v "iexplorer.exe" /f


    reg add "HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_SNIFFING" /v "iexplorer.exe" /d "0" /t REG_DWORD


    reg add "HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_handling" /v "iexplorer.exe" /d "0" /t REG_DWORD

    reg add HKEY_LOCAL_MACHINE\SOFTWARE\esawebmailregkeychanges

    Thursday, August 8, 2013 3:05 PM

Answers

  • Also this :
    ' Create String and DWORD Values
    
    
    Const HKEY_LOCAL_MACHINE = &H80000002
    
    strComputer = "."
     
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
        strComputer & "\root\default:StdRegProv")
     
    strKeyPath = "SOFTWARE\System Admin Scripting Guide"
    strValueName = "String Value Name"
    strValue = "string value"
    oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
     
    strValueName = "DWORD Value Name"
    dwValue = 82
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue



    Arnav Sharma | Facebook | Twitter Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by Cloud_TS Tuesday, August 13, 2013 12:11 PM
    Thursday, August 8, 2013 3:32 PM
  • Hi,

    We can easily try to copy following lines into a Notepad and save as modify.reg.

    Windows Registry Editor Version 5.00

    [HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_SNIFFING]

    " iexplorer.exe "=dword:00000000

    [HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_handling]

    " iexplorer.exe "=dword:00000000

    Before doing so, please backup your registry key to avoid any issue.

    I would like to share this article for your reference:

    How to add, modify, or delete registry subkeys and values by using a .reg file

    http://support.microsoft.com/kb/310516

    Hope these could be helpful and keep post.


    Kate Li

    TechNet Community Support

    • Marked as answer by Cloud_TS Tuesday, August 13, 2013 12:11 PM
    Friday, August 9, 2013 11:54 AM

All replies

  • What about VB script?
    ' Create a Registry Key
    
    
    Const HKEY_LOCAL_MACHINE = &H80000002
    
    strComputer = "."
     
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
        strComputer & "\root\default:StdRegProv")
     
    strKeyPath = "SOFTWARE\System Admin Scripting Guide"
    oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath



    Arnav Sharma | Facebook | Twitter Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, August 8, 2013 3:31 PM
  • Also this :
    ' Create String and DWORD Values
    
    
    Const HKEY_LOCAL_MACHINE = &H80000002
    
    strComputer = "."
     
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
        strComputer & "\root\default:StdRegProv")
     
    strKeyPath = "SOFTWARE\System Admin Scripting Guide"
    strValueName = "String Value Name"
    strValue = "string value"
    oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
     
    strValueName = "DWORD Value Name"
    dwValue = 82
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue



    Arnav Sharma | Facebook | Twitter Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by Cloud_TS Tuesday, August 13, 2013 12:11 PM
    Thursday, August 8, 2013 3:32 PM
  • Hi,

    We can easily try to copy following lines into a Notepad and save as modify.reg.

    Windows Registry Editor Version 5.00

    [HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_SNIFFING]

    " iexplorer.exe "=dword:00000000

    [HKLM\SOFTWARE\Microsoft\internet explorer\main\featurecontrol\feature_mime_handling]

    " iexplorer.exe "=dword:00000000

    Before doing so, please backup your registry key to avoid any issue.

    I would like to share this article for your reference:

    How to add, modify, or delete registry subkeys and values by using a .reg file

    http://support.microsoft.com/kb/310516

    Hope these could be helpful and keep post.


    Kate Li

    TechNet Community Support

    • Marked as answer by Cloud_TS Tuesday, August 13, 2013 12:11 PM
    Friday, August 9, 2013 11:54 AM