This is one of those commands that I really shouldn't have had to create. All I wanted to do was use stsadm to add an AD group to a site collection. Unfortunately the built-in adduser command requires email address and display name. The display name wasn't a huge deal but requiring an email just messed me up. So I created my own adduser command which allowed the email to be optional so that AD groups could be added via stsadm: gl-adduser2. I grabbed most of the code from my addsiteadmin command which I'd previously created and just pulled out the pieces that I didn't need (note that I didn't recreate the adduser command completely (I didn't implement the siteadmin parameter) - if you are adding a user then either mine or the built-in should work fine but I'd recommend just using mine when adding an AD group):
The syntax of the command can be seen below:
C:\>stsadm -help gl-adduser2 stsadm -o gl-adduser2 Adds a user to a site (allows for useremail and username to be optional). Parameters: -url <web url> -userlogin <DOMAIN\user> [-useremail <firstname.lastname@example.org>] [-username <display name>] [-role <role name> / -group <group name>]Here's an example of how to add the built in "nt authority\authenticated users" group to a site:
stsadm -o gl-adduser2 -url "http://intranet" -userlogin "nt authority\authenticated users" -group "Viewers"