Solved

Simple vbscript to modify registry key permission.

Posted on 2004-04-22
5
2,183 Views
Last Modified: 2007-12-19
Hi, I don't know vbscript but I have found a few code examples that do a nice job of doing 90% of a task I am trying to accomplish. I am stuck trying to find a very simple example of code to modify (grant everyone full-control) to a single registry key. Can anyone provide or reference me to a concise example of code to do this one specific task? I am not looking for a robust program just something very simple.

Thanks,
Scott
0
Comment
Question by:gscotte
  • 4
5 Comments
 
LVL 1

Expert Comment

by:calebS
ID: 10896841
I don't have any code examples, but was trying to do the same thing in VB, and it was yucky.

There is no simple '10 lines of code' way, it requires a couple of pages of code, I will have a look for a link, but just be warned...
0
 
LVL 1

Expert Comment

by:calebS
ID: 10896860
Hey, I might be wrong about this, the following link has a *.zip file download.

http://www.winnetmag.com/Article/ArticleID/37940/37940.html

NB. I found this on the second page of a google search, remember google is your friend...
0
 
LVL 1

Accepted Solution

by:
calebS earned 250 total points
ID: 10896864
Listing 1: Script to Write a Change to the Registry
Option Explicit
‘Define the variables to use.
Dim oWshShell
Set oWshShell = CreateObject("Wscript.Shell")
oWshShell.RegWrite ("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal
Server\Compatibility\Applications\AppName\Flags", 18)


Listing 3: Script to Confirm a Registry Setting
Option Explicit
Dim oWshShell, sValue
Set oWshShell = CreateObject("Wscript.Shell")
sValue = oWshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Terminal
Server\WinStations\RDP-TCP\PortNumber")
oWshShell.LogEvent 4, "Terminal Services is currently listening on port "& sValue & "."

0
 
LVL 1

Expert Comment

by:calebS
ID: 10896868
If this is so easy in VBScript why is it such a nightmare in VB??????
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

19 Experts available now in Live!

Get 1:1 Help Now