Re: Removing local users

Tech-Archive recommends: Fix windows errors by optimizing your registry




"Chris Hall" <someone@xxxxxxxxxxxxx> wrote in message
news:edroswn1FHA.3000@xxxxxxxxxxxxxxxxxxxxxxx
> Greetings,
>
> We've been using local users on about 100 PCs and are in the process on
> moving to a Windows A.D. environment. Is there an easy way to delete users
> from these workstations? Scripting, GPOs, etc? We're currently looking at
a
> piece of software--User Manager Pro--for this purpose, but would rather
save
> the dollars if possible. BTW, the PCs are w2k and xp.
>
> Thanks,
> Chris

You could run this batch file on each workstation:

@echo off
goto Start
--------------------------------------------------------------
Create a list of all users defined on this machine. Note that
the process will fail if there are user names with embedded
spaces.

17.6.2003 Fritz Lang
--------------------------------------------------------------

:Start
cd /d "%temp%"
net user | more +4 | find /i /v "successfully" >users.1

if exist users.2 del users.2
for /F "tokens=1" %%n in (users.1) do echo %%n>>users.2
for /F "tokens=2" %%n in (users.1) do echo %%n>>users.2
for /F "tokens=3" %%n in (users.1) do echo %%n>>users.2

type users.2 | sort > users.txt

for /F %%a in (users.txt) do if /i not %%a==Administrator (
echo net user %%a /del
echo rd /s /q "%allUsersProfile%\..\%%a"
)

Remove the words "echo" in the two lines towards the end
to activate the batch file.

You can use psexec.exe (www.sysinternals.com) if you wish
to run this script from a central location.
batc


.



Relevant Pages

  • Re: Command line : how to get the .cmd file name Im running
    ... I tried to use %CD%, but it seems that if the startup directory is a UNC share, it is unusable. ... (in a batch file, %0 is the path to the batch file including the batch ... @echo off ... torgeir, Microsoft MVP Scripting, Porsgrunn Norway ...
    (microsoft.public.windowsxp.general)
  • Re: How to know the PC domain
    ... I tried with batch file but i receive the message 'echo is off' and not the ... > Set colComputer = oWMI.ExecQuery _ ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsxp.configuration_manage)
  • Re: Delete all files in certain folders across multiple users
    ... scripting period. ... This little batch file will what you want. ... echo Cleaning up user "%*" ... You must determine if it is safe to delete the folders you specified. ...
    (microsoft.public.scripting.vbscript)
  • Re: Renaming a file
    ... I'm trying to create a batch file that renames a certain zip file. ... del %tmp%\today.vbs ... echo Todays date: %today% ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx. ...
    (microsoft.public.windowsxp.general)
  • Re: What is the command line scripting language?
    ... from a command prompt, they are just bunched together in a file. ... Echo This batch file will Force the Update Detection from the AU client by ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)