Solved

dsmod doesn't seem to be working

Posted on 2014-10-22
9
251 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 83

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 83

Expert Comment

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

Open in new window

0
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 83

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 83

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

To effectively work with Diskpart on a Server Core, it is necessary to write some small batch script's, because you can't execute diskpart in a remote powershell session. To get startet, place the Diskpart batch script's into a share on your loca…
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…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now