Group Membership

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 15 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Group Membership

Post by bbright20 »

Is there a way to use VBS to remove a user from a group and add them to another? Example - I have a user name that I need administrative rights in order to set some stuff up, but rather than going through the normal motions of changing the group membership, I was wondering if it's possible to get this done in VBS.I'd like to have a prompt box that asks what user name, then another prompt box that asks for which group...then a confirmation box that says "user" was successfully changed to "group" and the group membership to be changed of course.Thanks in advance.
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Group Membership

Post by bbright20 »

Is there a way to use VBS to remove a user from a group and add them to another? Example - I have a user name that I need administrative rights in order to set some stuff up, but rather than going through the normal motions of changing the group membership, I was wondering if it's possible to get this done in VBS.I'd like to have a prompt box that asks what user name, then another prompt box that asks for which group...then a confirmation box that says "user" was successfully changed to "group" and the group membership to be changed of course.Thanks in advance.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Group Membership

Post by jvierra »

You ae in luck. The answer is absolutely.

Start by looking into teh "Shareing Forum" here. Search for grouop members or AD roup and you will find a number of scripts that can do most of what you are asking.

Take a crack at making the sript perform the way you like. Post back with questions if you get stuck.

Here is a link t oget you started.
http://www.scriptinganswers.com/forum2/ ... asp?FID=24
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Group Membership

Post by bbright20 »

Thanks jvierra - that makes perfect sense to me. It had been a very long day yesterday when I posted that...sorry for not thinking it through a little more.That being said - is there any direction you can point me in to accomplish what you have laid out?Thanks again.
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Group Membership

Post by jhicks »

Here's some code to list all the groups in your domain:Set oNetwork=CreateObject("WScript.Network")Set oDomain=GetObject("WinNT://" & oNetwork.UserDomain)oDomain.Filter=Array("group")For Each oGroup In oDomain WScript.Echo oGroup.NameNext
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Group Membership

Post by jhicks »

I really think you are going to need to make this an HTA to get the graphical functionality I think you are after.
This topic is 15 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked