Solved

dsmod doesn't seem to be working

Posted on 2014-10-22
9
292 Views
Last Modified: 2014-10-23
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.
0
Comment
Question by:PotreroHill
  • 5
  • 4
9 Comments
 
LVL 84

Expert Comment

by:oBdA
ID: 40396528
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.
0
 

Author Comment

by:PotreroHill
ID: 40397702
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=
com"
dsmod failed:CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp,DC=company,DC=
com:Directory object not found.
type dsmod /? for help.
c:\>
0
 
LVL 84

Expert Comment

by:oBdA
ID: 40397775
What's the result of
dsquery group -samid "GeneralWireless"

Open in new window

0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

Author Comment

by:PotreroHill
ID: 40397877
This is the command and its output:

c:\>dsquery group -samid "GeneralWireless"
"CN=GeneralWireless,OU=Wireless,OU=Groups,DC=corp,DC=company,DC=com"

I'm wondering if it's a nesting issue... the security group is too 'deep'...
Thanks
0
 
LVL 84

Expert Comment

by:oBdA
ID: 40397897
Try
dsquery group -samid "GeneralWireless" | dsmod group -rmmbr "CN=user name,OU=Users,OU=Disabled,DC=corp,DC=company,DC=com"

Open in new window

0
 

Author Comment

by:PotreroHill
ID: 40398186
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
,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.
type dsmod /? for help.
0
 
LVL 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 40398586
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.
0
 

Author Comment

by:PotreroHill
ID: 40400843
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!
0
 

Author Closing Comment

by:PotreroHill
ID: 40400845
Extremely helpful, a very straight forward, systematic way to check the constituent elements in a straight forward query.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question