Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple vbscript to modify registry key permission.

Posted on 2004-04-22
5
Medium Priority
?
2,198 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 1000 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

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

715 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