Skip navigation

How can I disable a whole group of users?

A. There is no built in mechanism to do this but can be accomplished with 2 commands:

The first command users the resource kit utility SHOWMBRS.EXE outputing to a file:

C:\>showmbrs <domain>\<group> > users.txt
e.g. C:\>showmbrs savilltech\sales > users.txt

The second command iterates through the file and performs a net user <username> /active:no /domain

C:\>for /f "skip=2" %I in (users.txt) do net user %I /active:no /domain

An example output is as follows

Click here to view image

If you wanted to create a script enter the following into file dsblgrp.bat. The usage is

dsblgrp <group name>
e.g. dsblgrp savilltech\sales

REM
REM dsblgrp <group name>
REM by John Savill, 20th July 1998
REM
showmbrs %1 > users.txt
for /f "skip=2" %%I in (users.txt) do net user %%I /active:no /domain

Make sure you use two %% before the I or it won't work.

There is a problem with showmbrs.exe that only view groups with less than 7 members. To fix this download the fixed version from ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt40/i386/Shombrs.exe


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish