Solved

VBS Script that will write to the registry

Posted on 2013-06-06
4
396 Views
Last Modified: 2013-06-07
I need a quick vbs script that will write to the registry.  Since regedit is blocked on user machines I need to run this using a vbs script.  I appreciate the feedback!

HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\11.0\AdobeViewer
Value Name = TrustedMode
Value Data = 0
Reg_DWord

HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\11.0\Security\cPPKHandler
Value Name = bCustomPrefsCreated
Value Data = 1
Reg_DWord
0
Comment
Question by:mystikal1000
  • 2
4 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39225273
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strKeyPath = "Software\Adobe\Acrobat Reader\11.0\AdobeViewer"
strValueName = "TrustedMode"
dwValue = 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue

strKeyPath = "Software\Adobe\Acrobat Reader\11.0\Security\cPPKHandler"
strValueName = "bCustomPrefsCreated"
dwValue = 1
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue

 

Open in new window

0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39225308
Dim objFSO, WshShell

Set WshShell = WScript.CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")

WriteReg "HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\11.0\AdobeViewer\TrustedMode", "0", "REG_DWORD"
WriteReg "HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\11.0\Security\cPPKHandler\bCustomPrefsCreated", "1", "REG_DWORD"

Sub WriteReg(strKey, strValue, strType)
	WshShell.RegWrite strKey, strValue, strType   
End Sub

If Err.Number<>0 Then    
	MsgBox "Error #" & Err.Number & " " & Err.Source & " " & Err.Description
End If

set WshShell = Nothing

Open in new window

0
 
LVL 1

Author Comment

by:mystikal1000
ID: 39225437
Sedgwick

How do I create an another reg key called Security and Excludes via VBS?
Software\Adobe\Acrobat Reader\11.0\AdobeViewer\Security\Excludes

I appreciate your quick response! Thanks
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39225444
objRegistry.CreateKey HKEY_CURRENT_USER, "Software\Adobe\Acrobat Reader\11.0\AdobeViewer\Security\Excludes"

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
OfficeMate Freezes on login or does not load after login credentials are input.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question