dsmod doesn't seem to be working

I have a long list of disabled users I want to remove from a security group (wireless access group).
I tested the query until I got it correct. After that first successful test, all I'm getting now is "dsmod failed:CN=GeneralWireless.....". I've copied and pasted the DN of the security group from its properties' attributes, so I know I'm not mis-typing. I know the group is there, I have a Saved Query in ADUC that I can execute against the group. Here's what I've executed at the command line:

C:\>dsmod group CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp
,DC=company,DC=com -rmmbr "CN=user name,OU=Users,OU=Disabled,DC=corp,DC=company,DC=com"
dsmod failed:CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp,DC=company,DC=
com:Directory object not found.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You need double quotes around the group DN:
dsmod group "CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp,DC=company,DC=com" -rmmbr "CN=user name,OU=Users,OU=Disabled,DC=corp,DC=company,DC=com"

Open in new window

Edit: removed line breaks in command line.
PotreroHillAuthor Commented:
I'd tried that, but wanted to verify since I was working late and I got the same results. This is a copy/paste from DOS CLI. The double quotes shouldn't matter for the security group DN since there are no spaces in it.

I thought the issue might be 'smart quotes' so I made sure to check and remove them. But that didn't help either.

c:\>dsmod group "CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp,DC=company
,DC=com" -rmmbr "CN=user name,OU=Users,OU=Disabled,DC=corp,DC=company,DC=
dsmod failed:CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp,DC=company,DC=
com:Directory object not found.
type dsmod /? for help.
What's the result of
dsquery group -samid "GeneralWireless"

Open in new window

Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

PotreroHillAuthor Commented:
This is the command and its output:

c:\>dsquery group -samid "GeneralWireless"

I'm wondering if it's a nesting issue... the security group is too 'deep'...
dsquery group -samid "GeneralWireless" | dsmod group -rmmbr "CN=user name,OU=Users,OU=Disabled,DC=corp,DC=company,DC=com"

Open in new window

PotreroHillAuthor Commented:
Of course, remove the potential for copy/paste issues. Unfortunately it still failed. This is a DC, the Schema Master, PDC, and RID pool manager role holder. And I am running this elevated as Admin.
Thanks again!

c:\>dsquery group -samid "GeneralWireless" | dsmod group -rmmbr "CN=user name
dsmod failed:CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp,DC=company,DC=
com:Directory object not found.
type dsmod /? for help.
Then it can't find the user DN (which, for whatever reason, produces the same error message as when it can't find the group it's supposed to process).
Note that if the user name contains a comma (as in "LastName, FirstName"), the comma needs to be escaped with a backslash. If in doubt, use dsquery -samid UserSamAccountName to get the DN.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PotreroHillAuthor Commented:
So it worked, and it allowed me to find the problem.
c:\>dsquery user -samid Alanna.Meola
"CN=User  Name,OU=Users,OU=Disabled,DC=corp,DC=appdynamics,DC=com"

I saw it instantly, there are two spaces in the CN.

I can't quite remember how I created my original list, but it had an extra row of data. I opened it in Excel and found massive spaces after many names, so I used TRIM... Obviously it removed the extra space in the CN.

I need to created a list that I don't need to manipulate after created it.
Valuable lessons, don't take shortcuts, and if the output method doesn't provide exactly what you need, find a way that does.

Thank you for all your help!
PotreroHillAuthor Commented:
Extremely helpful, a very straight forward, systematic way to check the constituent elements in a straight forward query.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.