Pages

Wednesday, September 15, 2010

Useful commands for windows 2003 server administration

shutdown /m \\ /s /c "Server requires reboot due to app install" - The following two commands work with the
Windows Server 2003 version of shutdown.exe. This shuts a server down after the 30 seconds (default wait timer):
shutdown /m \\ /r /t 20 /c "Server is going down for repairs" - This command restarts a server after 20 seconds

shutdown \\ "Server is going down for repairs" - On Windows 2000, the shutdown options are a little different. This command shuts down a server (in 30 seconds by default):
shutdown \\ /r /t:15 "Server requires reboot due to app install" - And this restarts (/r option) a server in 15 seconds

All three of the following commands display the system uptime
psinfo \\ | findstr Uptime
srvinfo \\ | findstr /c:"Up Time"
systeminfo /s | findstr /c:"Up Time"

runas /user:administrator@rallencorp.com /netonly "mmc.exe" - Sometimes it is convenient to create a MMC console that runs under administrator privileges. In this case, simply use mmc.exe as the command to run from runas:

netsh int ip show config - view network configuration information is netsh
netsh int ip set address name="Local Area Connection" source=static 10.3.53.3 255.255.255.0 10.3.53.1 1 - This example configures a static IP address for "Local Area Connection":
netsh int ip show dns - view the current DNS configuration for all connections on the local machine

nltest /server: /DsGetSite - You want to find the Active Directory site a computer is part of, which is based on the IP address of the computer

linkspeed /s \\ - The Windows Server 2003 Resource Kit includes a new tool called linkspeed
linkspeed /s
linkspeed /dc - Alternatively, you can specify the /dc switch to have it test the machine's current domain controller

netsh interface ipv6 install - The following command installs the IPv6 stack. It must be run directly on the target server
psexec \\server01 netsh interface ipv6 install - If you need to run the command remotely, you can use the psexec

secedit /refreshpolicy machine_policy - You can force new auditing settings to be applied by running the secedit command on Windows 2000
gpupdate /target:computer - the gpupdate command on Windows Server 2003

cusrmgr -m \\ -u admininstrator -r - To rename local accounts, use the cusrmgr.exe utility from the Windows 2000
For example:
cusrmgr -m \\srv01 -u admininstrator -r admn

iisreset - The following command restarts all IIS services on the computer
iisreset 172.16.12.5 /stop - To stop IIS services on a remote computer with IP address 172.16.12.5
iisreset 172.16.12.5 /status - To verify that IIS services have been stopped on the remote computer
iisreset /disable - To prevent iisreset from being used to stop IIS services,
iisreset /stop - stop all IIS services

net stop w3svc - To stop the WWW service only on your IIS computer
net start w3svc - To start it again
net stop /y iisadmin - To stop the IISAdmin service and all dependent IIS services

iisweb /stop "Default Web Site" - To stop the Default Web Site only while leaving other web sites running
iisweb /start "Default Web Site" - To start it again

iisweb /create D:\HR "Human Resources" /i 216.44.65.8 - The following command creates a new web site named Human Resources on server with IP 216.44.65.8 and root directory D:\HR
iisweb /create D:\Corp "My Company" - The following command creates a new site named My Company with root directory D:\Corp and IP address "All Unassigned,"

iisvdir /create "Human Resources" employees D:\resumes - The following command creates a virtual directory within the Human Resources web site and maps alias employees to physical directory D:\resumes:
iisvdir /query "Human Resources" - list virtual directories within the Human Resources site:
iisvdir /delete "Human Resources\employees" - To delete the previously created virtual directory

iisback /backup /b 28july04 - The following command backs up the metabase using the iisback.vbs script and names the two backup files 28july04.MD0
iisback /list - To view a list of the current metabase backups

iisapp - The following command displays the process ID (PID) of all worker processes running on the computer,
iisapp /p 2765 - The following command displays the application pool to which the worker process having PID 2765 is assigned

iisftp /create C:\ftpstuff "My FTP Site" /i 172.16.12.50 /dontstart - The following command creates a new FTP site named My FTP Site with root directory C:\ftpstuff and IP address 172.16.12.50
iisftp /start "My FTP Site" - To start the new site,
iisftp /query - To display a list of all FTP sites on your server

net stop msftpsvc - You can also stop and start all FTP sites on your server using the following commands
net start msftpsvc

net stop dns - You can use the net.exe command to stop or start the DNS Server service on the local machine
net start dns

dnscmd /enumzones - view the zones on a local DNS Server
dnscmd /clearcache - The following command clears the server cache
dnscmd /statistics - Use the following command to display utilization statistics

unlock . * -view - unlock that lets you find locked out users and unlock them in one shot
unlock dc01 username - The following command unlocks the user rallen on dc01

dsmod user -disabled no - To enable a user
dsmod user -disabled yes - To disable a user
dsmod group "" -addmbr ""- The -addmbr option adds a member to a group
dsmod group "" -rmmbr "" - The -rmmbr option removes a member from a group

dsmod user -pwd * - This command changes the password for the user specified by .

dsget group "" -members - The following command displays the direct members of a group
dsget group "" -members -expand - Add the -expand option to enumerate all nested group members

dsadd computer "" -desc ""- Use the following command to create a computer account in Active Directory

netsh int ip set address name="" source=dhcp - The following command configures DHCP for a connection
netsh int ip set address name="Local Area Connection" source=dhcp - configuring the connection named "Local Area Connection" to use DHCP
netsh int ip set address name="Local Area Connection" source=static 10.3.53.3 255.255.255.0 10.3.53.1 1 - This example configures a static IP address for "Local Area Connection

Run any of the following commands to start a service
psservice start
sc start
wmic service call StartService
net start

Run any of the following commands to stop a service
psservice stop
sc stop
wmic service call StopService
net stop

sc queryex - The following command displays the process ID (PID) that corresponds to a service
sc \\ qc - The following command displays the services that the specified service depends on
sc \\ enumdepend - The following command displays the services that depend on the specified service
psservice \\ depend - You can also use the following command

taskkill -pid - The following command kills a process by PID
taskkill /s -im - And this command kills a process by name on a remote server
pskill \\ - The pskill.exe utility works in a very similar manner

tasklist - viewing the running processes via the command line
pslist \\ - The Sysinternals pslist.exe utility is available for Windows Server 2003 or Windows 2000 and can be run against a remote host
top - There is also the top.exe command, which is available in the Windows 2000 Resource Kit. It provides a continually updated view of the top running process (by CPU)

tlist | findstr cmd.exe - On Windows 2000, you can use the tlist.exe (or pslist.exe) command in combination with findstr.exe to find processes

runas /user: "" - The runas.exe command allows you to run a command with alternate credentials
runas /user:AMER\rallen.adm "mmc.exe" -

diskpart - On Windows Server 2003, you can use the diskpart utility to view the disk, drive, and volume configuration. First, get into interactive mode
list disk - to view the list of disks
list vol - to see the list of volume and assigned drive letters,

nltest /server: /sc_query: - The following command tests the secure channel for a computer
nltest /server: /sc_reset: - The following command resets the secure channel for a compute

Published Friday, February 13, 2009 2:11 PM by darenhan

No comments:

Post a Comment