Solved

Simple vbscript to modify registry key permission.

Posted on 2004-04-22
5
2,195 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
[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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

623 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