Solved

VBS Script that will write to the registry

Posted on 2013-06-06
4
389 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
Comment Utility
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 26

Expert Comment

by:MacroShadow
Comment Utility
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
Comment Utility
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
Comment Utility
objRegistry.CreateKey HKEY_CURRENT_USER, "Software\Adobe\Acrobat Reader\11.0\AdobeViewer\Security\Excludes"

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

A short article about problems I had with the new location API and permissions in Marshmallow
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now