Wednesday, December 14, 2011

Basic commands

Basic commands, windows admin's should know


Basic commands
View Last Reboot Time
net statistics server | more
Run a program as another user
runas /user:domain\username appname
ex: runas /user:jeffk cmd.exe


Remote Desktop into Console of specific computer
Mstsc /v:computername /console
Ex: mstsc /v:deserver /console
Map a network Drive
Net use drivename: \\server\share
Net use z: \\daserver\music
Force network credentials
Net use \\server\sharename /user:domain\user
Ex: net user \\daserver\music /user:jeffk
Tip: Before using this you may want to issue net use * /d to delete previously stored credentials, or you can view your credentials by just typing net use

Environmental Variables 
use these at start>run to quickly goto or anywhere in explorer
Tip: Type set to see your variables
%windir%
%systemdrive%
%appdata%
%userprofile%
%programfiles%
%allusersprofile%
%temp%


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 2008 and can be run against a remote host
top - There is also the top.exe command, which is available in the Windows 2003 Resource Kit. It provides a continually updated view of the top running process (by CPU)

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 2008, 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,

0 comments:

Post a Comment