Solved

Vbscript question about Adding remote desktop users on Windows XP

Posted on 2006-11-16
3
522 Views
Last Modified: 2012-06-27
How can the following process be automated.

Go to control panel
click on system
select the tab Remote
Click on select remote users.
Select another user.
0
Comment
Question by:itbabe
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
mdiglio earned 500 total points
ID: 17957227
Hello,

This script will prompt you for a username then add it to the Remote Desktop Group


Set wshshell = CreateObject("WScript.Shell")
strDomain = wshshell.ExpandEnvironmentStrings("%USERDOMAIN%")
strComputer = wshshell.ExpandEnvironmentStrings("%COMPUTERNAME%")

strUser = InputBox("Enter the User Name for Remote Access")

Set objGroup = GetObject("WinNT://" & strComputer & "/remote Desktop users,group")
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
objGroup.Add (objUser.ADsPath)
0
 
LVL 16

Expert Comment

by:mdiglio
ID: 17971376
Hello,
You will need to copy what I wrote above into notepad then save it with a .vbs extension.
When you run it, you will be asked to enter a username
0
 
LVL 6

Expert Comment

by:tone28
ID: 17975327
Remote Desktop may not be enabled. I noticed that the above code only works for the local computer. So here is code to change the reg setting so Remote Desktop is enabled.

remoteEnabled = wshshell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections")
If remoteEnabled = 1 Then
        wshshell.RegWRite "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections",0,"REG_DWORD"
End If
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 …
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…
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…

747 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

12 Experts available now in Live!

Get 1:1 Help Now