Solved

Simple vbscript to modify registry key permission.

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

910 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

21 Experts available now in Live!

Get 1:1 Help Now