Link to home
Start Free TrialLog in
Avatar of CRIIT
CRIITFlag for Afghanistan

asked on

VBScript to add domain user to the computer’s RDC user list

Dear Experts:

I have a VBScript to add domain user to the computer’s RDC user list. See below.
Set objGroup = GetObject("WinNT://Win7-64-1.domain1.org/remote Desktop users,group")
Set objUser = GetObject("WinNT://domain1.org/user1,user")
objGroup.Add (objUser.ADsPath)

When the user and computer in the same domain, it is fine.
When the user and computer in the different domains though there is two-way trust between the domains, it does not work. However, I can add it manually.

Set objGroup = GetObject("WinNT://Win7-64-1.domain1.org/remote Desktop users,group")
Set objUser = GetObject("WinNT://domain2.org/user2,user")
objGroup.Add (objUser.ADsPath)

I am running on Windows AD server 2008 R2 environment.

Do you have any advices?
Thanks a lot!
Avatar of rsimsee
rsimsee
Flag of United States of America image

Are you getting any kind of error message when it fails?  The question is whether or not it can't find the domain, or whether or not it gets an access denied when accessing it...
Avatar of CRIIT

ASKER

Thanks for your reply. You are right. I need to get some message from there.

I added Err = objGroup.Add (objUser.ADsPath)
to get the Err = 1A8 (424) Do you any ideas for that?
Thanks!
I did a quick search and came up with this:

"A 424 error is a 'object required' error being thrown from within xyz.vbs."

So it sounds like it needs another parameter in order to work correctly.
Avatar of CRIIT

ASKER

Yeah, the error means that username dose not exist in the Active Directory.
But, I build the two-ways trust between the domains and I can add the user manually.
Is there any parameters that I can add on the "objGroup.Add (objUser.ADsPath)"?
I didn't find the syntax for that.
Another solution, is there the powershell script for that function?
Thanks,
ASKER CERTIFIED SOLUTION
Avatar of rsimsee
rsimsee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CRIIT

ASKER

Thanks, rsimsee