Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

dsmod doesn't seem to be working

Posted on 2014-10-22
9
Medium Priority
?
438 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 85

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 85

Expert Comment

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

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 85

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 85

Accepted Solution

by:
oBdA earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
OfficeMate Freezes on login or does not load after login credentials are input.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

916 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