Re: Removing old members from...

From: B. Goodman (
Date: 06/13/03

Date: Fri, 13 Jun 2003 10:19:14 -0400

In article <0eca01c330fa$e2068060$a401280a@phx.gbl>, says...
> Is there a way to clean up the members/workstations on a
> NT 4 domain.
> We have about 300 PCs, but I show over 1300 members when I
> view the workstation list.
> Is there any setting to drop old members if they haven't
> connected in the past few weeks?
> Thanks much,
> Ken
I think you may be able to script it, if you do a little research.
First, see, which is "Batch
File Adds/Removes Machine Accounts in Server Manager". Then look at, "Network Account Password
Age (NetPWAge) freeware."

It seems to me you could use a command like:
netpwage /machines /b /tabs > %temp%\machinelist.tsv

to generate a tab-delimited list into a file called "machinelist.tsv",
then tweak the batch file MS lists in Q140387.

Try putting this in as your batch file:

@echo off
set maxage=80
set temp1=%temp%\machinelistfull.tsv
set temp2=%temp%\machinelistpurge.tsv
if exist %temp1% del /q %temp1%
if exist %temp2% del /q %temp2%
netpwage /b /machines /tabs > %temp1%
for /f "tokens=1-3" %%x in (%temp1%) do (if %%z GEQ %maxage% echo %%x
        %%y %%z >> %temp2%)
for /f "tokens=1" %%a in (%temp2%) do (echo %%a)


Scrutinize your results in the file, machinelistpurge.tsv. Be SURE that
there is nothing there that should NOT be there. As written, this batch
file won't differentiate between a server and workstation.

If you are convinced that everything is correct, replace the (echo %%a)
in the last line with (net computer \\%%a /del)

WARNING: I just through this together. I have NOT tested the actual
delete process, because it must be run from a domain controller. The
rest was tested on Win 2K Pro, and I am not certain if (if %%z GEQ %
maxage%) part will run correctly on NT 4 server.

I am also not certain how reliable the information is that netpwage

IMPLIED, to anything I have written here. USE AT YOUR OWN RISK!

Be VERY careful. Batch deletes of things can get a person FIRED!


Relevant Pages

  • Automatically downloading files daily by psftp
    ... I am modifying my previous written batch file ... My previous operation is that I have a batch file which lists the ... server and run psftp with another cmd for the software. ... Batch file(contain of list of server ips; ...
  • Re: 2.6.14-rc2-mm1
    ... > batch value for the cold pcp list. ... >> for jumbo ethernet, or NFS, you want to drain the lists? ... > Not every time there is a request for higher order pages. ...
  • Re: 2.6.14-rc2-mm1
    ... >> for cold list to same as pcp's batch number. ... > for jumbo ethernet, or NFS, you want to drain the lists? ... Not every time there is a request for higher order pages. ...
  • Re: Help with puzzle on Stained Glass Window
    ... these other batch numbers on the same site I mentioned before, ... she was baptized there in the Church of Scotland (which is fairly ... which covers baptisms in the Falkirk parish church ... I've looked at passenger lists for assisted immigrants arriving on ships c. ...