?
Solved

VBS Script that will write to the registry

Posted on 2013-06-06
4
Medium Priority
?
402 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

752 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