Useful commands for Windows

How many users are logged on/connected to a server

 NET SESSION | FIND /C "\"

Who is logged on to a computer

NBTSTAT -a remotecomputer | FIND "<03>" | FIND /I /V "remotecomputer"

What is the full name for this login name

NET USER loginname /DOMAIN | FIND /I " name "
or
DSQUERY USER -samid *loginname* | DSGET USER -samid -display

When did someone last change his password

NET USER loginname /DOMAIN | FIND /I "Password last set"

How to reset someone’s password

NET USER loginname newpassword /DOMAIN

Is someone’s account locked

NET USER loginname /DOMAIN | FIND /I "Account active"

How to unlock a locked account

NET USER loginname /DOMAIN /ACTIVE:YES

or, if the password needs to be reset as well:

NET USER loginname newpassword /DOMAIN /ACTIVE:YES

List all domains and workgroups in the network

NET VIEW /DOMAIN

List all computers in the network

NET VIEW

List all domain controllers

2000 Server:
NETDOM QUERY /D:MyDomain DC
2003 Server:
DSQUERY Server

List all drivers on any PC

DRIVERQUERY /V /FO CSV > %ComputerName%.csv

List all printers on any PC

WMIC /Node:remote_PC Path Win32_Printer Get DeviceID

Disable Windows Firewall for domain only

NETSH Firewall Set OpMode Mode = DISABLE Profile = DOMAIN

Completely disable Windows Firewall

SC [ \Remote_computer ] Stop SharedAccess
SC [ \Remote_computer ] Config SharedAccess start= disabled

List all local administrators

 

NET LOCALGROUP Administrators

Delete a computer account

NETDOM /DOMAIN:MyDomain MEMBER \computer2Bdeleted /DELETE

Windows Vista SP2 RC

Microsoft has released RC Escrow build of Windows Vista and Server 2008 SP2. A few selected testers have been e-mailed by Microsoft about this latest build.

The build number is 6002.16659.090114-1728 and is very close to RTM version.

The build can be downloaded via Windows Update using a small registry script or as a standalone installer or slipstreamed ISO.

The ISO version is available in 5 languages: English, Spanish, German, French, Japanese.

The build doesn’t support upgrade from previous SP2 build, so you’ll need to uninstall any previous build of SP2 before installing this RC build.

RC build can be uninstalled from «Control Panel -> Programs and Features -> View Installed Updates«