Académique Documents
Professionnel Documents
Culture Documents
Home
Regular Expressions Managing a Windows 2000 Active Directory with about 100 servers, over 1500 computers
and 35 sites, the following commands often helped me answer questions or solve
Rexx problems.
VBScript & WSH Most commands are "one-liners", but for some I had to make an exception and go to the
right directory first.
WMI
ADSI These commands could all be used in batch files, though some may need some "parsing"
with FOR /F to retrieve only the required substrings from the displayed information.
Silent Installs
Books
Scripting Tools Notes: (1) Commands that use external, or third party, or non-native utilities
Miscellaneous contain hyperlinks to these utilities' download sites.
Search (2) Replace command arguments displayed in italics with your own
values.
Print This Page
(3) Commands or utilities that require Windows Server 2003 are marked
bright blue.
How many users are logged on/connected to a server (and who are they)?
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
"I need an up-to-date list of disk space usage for all servers, on my desk in 5
minutes"
Related links
By replacing FIND /C "\\" by FIND "\\" (removing the /C switch) you'll get a list of
logged on users instead of just the number of users.
The first name in the list usually is the logged on user (try playing with the NET NAME
command to learn more about the names displayed by NBTSTAT).
This is the fastest way to find the logged on user name, and the results that you do get
are correct, but NBTSTAT won't always return a user name, even when a user is logged on.
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
This is arguably the most reliable (native) command to find out who is logged on.
PSLOGGEDON -L \\remotecomputer
or:
or:
or for Windows 7:
NETSH and WMIC are for XP or later, and are the most reliable of all commands shown
here.
WMIC requires WMI enabled remote computers and Windows XP on the administrator's
computer; NETSH requires Windows XP on the local and remote computers.
PSLOGGEDON is a more accurate solution than NBTSTAT, but it will return the last logged on
user if no one is currently logged on.
The NET and NBTSTAT commands show more or less identical results, but the NBTSTAT
command is much faster.
The REG command is accurate, but may need to be modified depending on the version
used.
As displayed here, the code is written for REG.EXE 2.0 (Windows 2000) and later.
More information on REG versions can be found on my REG Query page.
For Windows NT 4 and 2000: use NBTSTAT (fast, but it won't always return the user
name!), and only switch to REG if NBTSTAT doesn't return a user name (modify the REG
command for Windows NT 4).
For Windows XP: if you want to search lots of computers for logged on users, I
recommend you try NBTSTAT first (fast, but it won't always return the user name!), and
only switch to NETSH, REG or WMIC (accurate) if NBTSTAT doesn't return a user name.
For Windows Vista and later: use REG or WMIC (accurate).
Credits: Jirí Janyška (WMIC command) and Matthew W. Helton (NETSH command).
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
My collegues often forget to mention their logon account name when calling the helpdesk,
and the helpdesk doesn't always ask either. I suppose they expect me to know all 1500+
accounts by heart.
With (native) Windows Server 2003 commands only:
Note: Windows Server 2003's "DSTools" will work fine in Windows 2000 and XP too,
when copied.
Keep in mind, however, that some Windows Server 2003 Active Directory
functionality is not available in Windows 2000 Active Directories.
Note: The NET command may seem more universal, because it requires neither Active
Directory nor Windows Server 2003 commands, but it is language dependent!
For non-English Windows you may need to modify FIND's search string.
CD /D d:\directory2check
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
SHOWACLS /U:domain\userid
Note: To prevent the new password from being displayed on screen replace it with an
asterisk (*); you will then be prompted (twice) to type the new password
"blindly".
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
NET VIEW
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000
installation CDROM.
DSQUERY Server
or, if you prefer host names only (tip by Jim Christian Flatin):
or, to find the FSMO with (native) Windows Server 2003 commands (Active Directory
only):
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000
installation CDROM.
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000
installation CDROM.
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000
installation CDROM.
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000
installation CDROM.
2. a list of server names in a file named SERVERS.TXT, one server name on each line,
If you have a strict server naming convention, SERVERS.TXT itself can be generated with
the NET command:
Notes: (1) assuming server names start with "SRV-"; modify to match your own
naming convention.
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]
Useful commands for Windows administrators
Related links:
The PSTools: and many other useful tools can be found at SysInternals.
Download several Windows 2000 Resource Kit Tools for free from Microsoft's web site.
http://www.robvanderwoude.com/ntadmincommands.php[21/Nov/2010 13:41:59]