Solved

VBS Script that will write to the registry

Posted on 2013-06-06
4
391 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

919 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

20 Experts available now in Live!

Get 1:1 Help Now