View Single Post
Old 04-27-2009, 07:57 AM   #2 (permalink)
office politics
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default Re: Help with Remote Desktop batch help

you're going to want to add the user to multiple remote machine's remote desktop user group.

this script will add them to admin group. make changes as necessary


List users in local administrators group on remote machine

Quote:
10 Oct 2008 5:04 PMRichard Mueller [MVP]
Nick wrote:


Show quote
Hide quote
>
> I am looking to manage all desktops on our network with regard to the
> local
> administrators group. There are several things I am looking to
> accomplish:
>
> 1. list all users (domain and local) in local administrators group on
> multiple remote computers
> 2. remove user from local administrators group on remote computer
> 3. add domain user account to local administrators group on remote
> computer
> 4. remove local user account from remote computer
> 5. Report on current members of the local administrators group.
>
> Any assistance you can provide would be greatly appreciated.
> We have .Net software if that would be the best way to tackle this but I
> am
> not sure which way to go.


I have an example VBScript program that enumerates all members of local
Administrators group linked here:

Enumerate Local Group

The program handles membership due to nested local and domain groups. In
VBScript you use the WinNT provider with local objects. To add and/or remove
users (or groups) from a local group use code similar to below. With the
steps that check for direct membership (does not reveal membership due to
group nesting), you may not need to enumerate membership:
=========
' Specify NetBIOS name of computer.
strComputer = "Test001"

' Specify NetBIOS name of domain.
strDomain = "MyDomain"

' Bind to local Administrators group on remove computer.
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")

' Add a local user to the group.
' Check first if they are already a direct member.
Set objLocalUser = GetObject("WinNT://" & strComputer" & "/JimSmith,user")
If (objGroup.IsMember(objLocalUser.AdsPath) = False) Then
objGroup.Add objLocalUser.AdsPath
End If

office politics is offline