Showing posts with label Useful commands. Show all posts
Showing posts with label Useful commands. Show all posts

Wednesday, June 5, 2019

Netbackup Cheat Sheet

Master Server Daemons/Processes

Request daemonbprd
Schedulerbpsched (started with bprd)
Netbackup database managerbpdbm (started with bpsched)
Job Monitorbpjobd (started with bpdbm)
Media Server Daemons/Processes

Communications daemonbpcd
Backup and restore managerbpbrm (started with bpcd)
Tape Managerbptm (started with bpbrm)
Disk Managerbpdm (started with bpbrm)
Media Managerltid
Bar code readeravrd (started with ltid)
Remote device management/ controls volume databasevmd (started with ltid)
Roboticdaemon (one on each media server) talks to tldcdtldd (started with ltid)
Robotic control daemon talks to the robot directl via scsitldcd (started with ltid)
Catalogs

Master Server
Information about backed-up filesimage - /opt/openv/netbackup/db
Storage Unit, Global Configuration, Catalog backup configuration.config - /opt/openv/netbackup/db
Backup Policy informationclass - /opt/openv/netbackup/db
Job status informationjobs - /opt/openv/netbackup/db
Netbackup logs with error and status informationerror - /opt/openv/netbackup/db
Information on volumes, volume pools, scratch pool and volume groupsvolume - /opt/openv/volmgr/database
Media Server
Tracks assigned volumes (media that has data them)media - /opt/openv/netbackup/db
Information about devices managed by the media serverdevice - /opt/openv/volmgr/database
Log and Information Files

Netbackup and Patch versions/opt/openv/netbackup/bin/version
Media Version/opt/openv/volmgr/version
Patch Level history/opt/openv/netbackup/patch/patch.history
Buffer size/opt/openv/netbackup/db/config/SIZE_DATA_BUFFERS
Number of buffers/opt/openv/netbackup/db/config/NUMBER_DATA_BUFFERS
Network Buffer Size/opt/openv/netbackup/NET_BUFFER_SZ (default = 32)
Java GUI authorisation/opt/openv/java/auth.conf
Catalog type (binary or ASCII)/opt/openv/netbackup/db/config/cat_format.cfg
Netbackup and media manager parameter files/opt/openv/netbackup/bp.conf
/opt/openv/volmgr/vm.conf
Corrupt Database image files (5.0 and above)/opt/openv/netbackup/db.corrupt
Server Commands

Check license details/opt/openv/netbackup/bin/admincmd/get_license_key
Start Netbackup
netbackup start

/opt/openv/netbackup/bin/initbprd (master)
/opt/openv/volmgr/bin/vmd (media)
Stop Netbackup (does not disconnect GUI sessions)
netbackup stop
/opt/openv/netbackup/bin/admincmd/bprdreq -terminate (master)
/opt/openv/netbackup/bin/bpdbm -terminate (master)
Stop Netbackup and kill all GUI sessions/opt/openv/netbackup/bin/goodies/bp.kill_all
Start the GUI/opt/openv/netbackup/bin/jnbSA
Scan for tape devicessgscan (solaris)
ioscan (HPUX)
Display all Netbackup processesbpps -a
lists servers errors
bperror -U -problems -hoursago
bperror -U -backstat -by_statcode -hoursago
display information on a error codebperror -statuscode [-recommendation]
Reread bp.conf file without stopping Netbackupbprdreq -rereadconfig
Check database consistency
bpdbm -consistency 1
bpdbm -consistency 2
Check for the below lines:
Bad image header
Does not exist
Netbackup Recovery
Device catalog is intactbprecover -l -m -d dlt (listing)
bprecover -r -m -d dlt (recovering)
Device catalog is gone or corruptedbprecover -l -tpath (listing)
bprecover -r -tpath (recovering)
Disk backupsbprecover -l -dpath (listing)
bprecover -r -dpath (recovering)
Volume Commands

Tape Drive and Inventory Commands
List drive status, detail drive info and pending requestsvmoprcmd
List the tape drive statusvmoprcmd -d ds
List the pending requestsvmoprcmd -d pr
Control a tape devicevmoprcmd [-reset][-up][-down]
List all changes in the robot(but do not update)
vmupdate -recommend -rt tld -rn 0
vmcheckxxx -rt tld -rn 0 -recommend
Empty the robot and re-inventory (using barcodes)vmupdate -rt tld -rn -rh -vh -nostderr -use_barcode_rules -use_seed -empty_ie
Tape Media Commands
List all poolsvmpool -listall -bx
List tapes in poolvmquery -pn -bx
List all tapes in the robotvmquery -rn 0 -bx |grep 'TLD' | sort +4
List cleaning tapesvmquery -mt dlt_clean -bx
List tape volume detailsvmquery -m
Delete a volume from the catalogvmdelete -m
Change a tapes expiry datevmchange -exp 12/31/06 23:59:58 -m
Change a tape's media poolvmchange -p -m
 Media commands

List the storage unitsbpstulist -U
Freeze or unfreeze mediabpmedia [-freeze][-unfreeze] -ev
List media detailsbpmedialist -ev
List media contentsbpmedialist -U mcontents -m
List backup Image Informationbpimagelist -backupid
Expire client imagesbpimage -cleanup -allclients
Expire a tapebpexpdate -d 0 -ev -force
List all netbackups jobsbpdbjobs -report [-hoursago]
Move media from one media server to anotherbpmedia -movedb -newserver -oldserver
Tape/Robot commands

List tape drivestpconfig -d
List cleaning times on drivestpclean -L
clean a drivetpclean -C
change a drives cleaning frequencytpclean -F
set a drives cleaning time to zerotpclean -M
Move tapes within robot using robtest
robtest
commands that can be used are as follows:

s s (show slots)
s d (show drives)
s i (show load port)
m s250 d5 (move tape from slot 250 into drive 5)
uload d5 (unload tape from drive 5)
m d5 s250 (move tape from drive 5 to slot 250)
m s250 i1 (mov tape from slot 250 to load port 1)

List load port tapesecho "s i q" | tldtest -r /dev/sg/c0t4l0
List all slot contentsecho "s s q" | tldtest -r /dev/sg/c0t4l0
List tape drive contentsecho "s d q" | tldtest -r /dev/sg/c0t4l0
Move a tape in s100 to drive 1echo "m s100 d1" | tldtest -r /dev/sg/c0t4l0
Move a tape to load port 1echo "m s100 i1" | tldtest -r /dev/sg/c0t4l0
Archiving Commands

list archive info
bpcatlist -client all -before Jul 01 2006
bpcatlist -client all -before Aug 01 2006
archive and remove imagesbpcatlist -before Jul 01 2006 | bpcatarc | bpcatrm
restore archive files
bpcatlist -before Jul 01 2006 | bpcatres
Client commands

test client connectivity
bpclntcmd [-ip ]
bpclntcmd [-hn ]
bpclntcmd [-pn]
bpclntcmd [-sv]

Thursday, February 7, 2019

NetBackup Tutorial: Steps to verify device configuration using "robtest"

NetBackup Tutorial: Steps to verify device configuration using "robtest"


The process to absolutely verify that the drive path mapping is correct on all of the media servers is a bit time consuming, but will ensure that everything is correct. 

Step 1 
Please note that this test cannot be run while VERITAS NetBackup (tm) is attempting backups, restores, duplicates, or any other actions that involve the robot and drives. 

Step 2 
Acquire the output of " /usr/openv/volmgr/bin/tpconfig -d " from each of the media servers. This is the drive configuration within NetBackup for each server. 

Tuesday, December 11, 2018

Netbackup (CLI) Important Commands (Useful Commands) and Explanations


NetBackup: Create Backup Policy in Veritas NetBackup (Symantec) – Verify Windows or Unix Policy

Being a NetBackup backup administrator we should know minimum commands to manage our regular tasks with a simple CLI commands, here I listed few which should know by every NetBackup administrator.

Master Server
1) Check the license details
/usr/openv/netbackup/bin/admincmd/get_license_key

2) Stop and Start the netabackup services

WINDOWS:
Stop the NetBackup Services. 
\Veritas\NetBackup\bin\bpdown /f /v
start the NetBackup Services.
\Veritas\NetBackup\bin\bpup /f /v

UNIX:
i) /etc/init.d/netbackup stop (start)       —>  graceful stop and start
ii) /usr/openv/netbackup/bin/bp.kill_all    —> Stop backup including GUI sessions, ungraceful
iii) /usr/openv/netbackup/bin/bp.start_all —> Start the backup                   
iv) /usr/openv/netbackup/bin/initbprd      —> starts the master server
v) /usr/openv/netbackup/bin/vmd           —> starts the media server
vi) /usr/openv/netbackup/bin/jnbSA        —> Starts the GUI sessions

Thursday, August 6, 2015

15 Must Know Windows Run Commands - Updated

On the Microsoft Windows operating system, the Run command is used to directly open an application or document whose path is known.

15 Must Know Windows Run Commands - Updated


We will show up you 15 awesome Run commands that’d helps you to bypass a series of clicks, thereby making things faster in your daily usage of Windows.

Wednesday, February 8, 2012

Upgrade from Windows Server 2003 Domain Controller to Windows Server 2008



Introduction

I have been using Windows Server 2003 for years and I believe its time to shift and try using Windows Server 2008, I have downloaded RC0 and decided to Upgrade my Domain Controller, which is also a DNS & DHCP Server to Windows Server 2008 Standard Edition RC0. In this article, I will show you step by step how to perform an in-place upgrade for a Domain Controller from Windows Server 2003 To Windows Server 2008 RC0

Note: This article was written when Windows Server 2008 was still RC0. Changes might occur later once the product is RTM'd Upgrade Steps
  1. On you Windows Server 2003 DC, insert the Windows Server 2008 DVD, and then open command prompt and run the following commands, make sure first to browse to the adprep directory inside the Windows 008 DVD , in my case case, the F drive is the DVD Drive letter, so to browse to the adprep directory I would write the following inside cmd:cd f:\sources\adprerp

    adprep/ forestprep

Tuesday, August 2, 2011

Useful VMware Commands


Useful VMware Commands


Restart management services:
Service mgmt-vmware restart
Find DNS servers:
Cat /etc/resolv.conf
Check ESX version:
esxupdate query
Restart vmware management:
service vmware-vpxa restart
service mgmt- vmware restart
vdf –h
view partion info (disk space etc)
ls –larth
list files in a directory in by GB, MB (easy to see file sizes)
ls –larth *delta*
as above but only show files with “delta” in the name
List registered VMs:
vmware-cmd –l (gives machine id)
Check if VM powered on (e.g.):
vmware-cmd /vmfs/volumes/4a006885-0aed81dd-0cdc-002219b72e1d/Exchange01/Exchange01.vmx getstate
Check if VM powered on (e.g.):
Type ifconfig to check the current IP address.
esxcfg-vswif -i x.x.x.x vswif0
Example esxcfg-vswif -i 10.0.1.3 vswif0
Check jumbo frames are working
Vmkping –s 9000
ifconfig
Display IP information

Please Click any of the following link


Setup the vSphere Management Assistant


Setup the vSphere Management Assistant



The below article describes the initial stpes in setting up a vSpehre Management Asssitant appliance.

Step 1 – Download and Install


  • Go to the Vmware website and download the latest version of the VMA appliance
  • This comes as a .zip file. Extract this file. You should get the files below
  • You can then create the VMA appliance using the .ovf file
  • Once the VMA files have finished uploading to your ESX server you can then power on the newly created VM.
  • Connect to the console of the new VM and run through the various setup options specifying IP addresses etc.

Step 3- Set Time Zone and Keyboard


Use the “date” command to view the current date, time and time zone info. If you need to change these enter the commands

Set Time Zone:
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/GMT /etc/localtime
(If your timezone is not GMT browse the zoneinfo directory for other timezones)

You can set the time with the below command
Sudo date –set “28 Jan 2010 18:00:00″
(note there is a double hyphen)
Set Keyboard
sudo nano /etc/sysconfig/keyboard
(Choose the appropriate keyboard option – in the below case its “uk”)


Step 3 – Add to Active Directory (optional)


If desired you can add the VMA to your Active Directory Domain. Enter the below on the VMA console
sudo domainjoin-cli join
You will need to reboot

Step 4 – Enable the vi-user account


By default the vi-user account cannot be used until you have specified a password.
sudo passwd vi-user

Step 5 – Add standalone ESX\ESXi server


You can add target servers running virtual centre 4.0 + and ESX\ESXi3.5+
To add a standalone ESX\ESXi server run the below command
vifp addserver
You will be prompted for the root username and password. You can verify the target servers in use with the command
Vifp listservers
Please Click any of the following links

Monday, July 25, 2011

Quick tip: Launching the Hidden Command Prompt while installing Windows


Quick tip: Launching the Hidden Command Prompt while installing Windows


During the installation of Windows, its is possible to launch the command prompt after entering the username and password.
_commandprompt2_wininstall_virtualpc
_commandprompt10_wininstall_virtualpc
Just press Shift + F10 and the command prompt will appear.
By this you can enable the hidden administrator (inactive) account and others, tweak anything while installing, and verify the settings through command prompt.
Cool right?!
Tested the installation using Virtual PC running 512mb, enabled virtualization and 2 Ghz Core2duo processor while using the classic theme of windows... Its fast.. Thanks for reading the article!

Monday, October 12, 2009

Creating a Batch to free up disc space

Creating a Batch to free up disc space






You can free up spaces on your hard drive. Just follow these instructions:

Open Notepad, copy and paste:

CD\
CD %APPDATA%
CD..
CD LOCAL\MICROSOFT\WINDOWS\EXPLORER
DEL *.db
CD\
CD %Windir%
CD SoftwareDistribution
DEL /F /S /Q Download
vsp1cln /quiet /verbose
vssadmin resize shadowstorage /On=C: /For=C: /Maxsize=3GB

reg add hklm\SYSTEM\CurrentControlSet\Services\VSS /v Start /t REG_DWORD /d 3 /f

reg add hklm\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore\cfg /v DiskPercent /t REG_DWORD /d 5 /f

Then click on FILE > SAVE AS

On Save as type: Select All files
Give the file a name which ends with .bat
Click Save

To run the file, you have to right click on it> Run as administrator.

You can also use CCleaner






Command prompts for Windows

Command prompts for Windows





Some of these command below can cause harmful an undesirable functions, leading to the formatting of your hard disk and data loss, while others will not run under Windows XP. As for Windows Vista the Run Tab is not visible in the start up menu. Windows Vista specific command prompts are not included.

Feel free to add any additional information and tips, you think necessary.

Here is a list of commands you can use under Microsoft Windows prearranged depending of their functionality :

  • Control Panel
  • Windows utility and applications
  • Disk management
  • Connection management
  • Miscellaneous commands




Control Panel

  • CONTROL: opens the control panel window
  • CONTROL ADMINTOOLS: opens the administrative tools
  • CONTROL KEYBOARD: opens keyboard properties
  • CONTROL COLOUR: opens display properties.Appearance tab
  • CONTROL FOLDERS: opens folder options
  • CONTROL FONTS: opens font policy management
  • CONTROL INTERNATIONAL or INTL.CPL: opens Regional and Language option
  • CONTROL MOUSE or MAIN.CPL: opens mouse properties
  • CONTROL USERPASSWORDS: opens User Accounts editor
  • CONTROL USERPASSWORDS2 or NETPLWIZ: User account access restrictions
  • CONTROL PRINTERS: opens faxes and printers available
  • APPWIZ.CPL: opens Add or Remove programs utility tool
  • OPTIONALFEATURES: opens Add or Remove Windows component utility
  • DESK.CPL: opens display properties. Themes tab
  • HDWWIZ.CPL: opens add hardware wizard
  • IRPROPS.CPL: infrared utility tool
  • JOY.CP: opens game controllers settings
  • MMSYS.CPL: opens Sound and Audio device Properties. Volume tab
  • SYSDM.CPL: opens System properties
  • TELEPHON.CPL: Opens phone and Modem options
  • TIMEDATE.CPL: Date and Time properties
  • WSCUI.CPL: opens Windows Security Center
  • ACCESS.CPL: opens Accessibility Options
  • WUAUCPL.CPL: opens Automatic Updates
  • POWERCFG.CPL: opens Power Options Properties
  • AZMAN.MSC: opens authorisation management utility tool
  • CERTMGR.MSC: opens certificate management tool
  • COMPMGMT.MSC: opens the Computer management tool
  • COMEXP.MSC or DCOMCNFG: opens the Computer Services management tool
  • DEVMGMT.MSC: opens Device Manager
  • EVENTVWR or EVENTVWR.MSC: opens Event Viewer
  • FSMGMT.MSC: opens Shared Folders
  • NAPCLCFG.MSC: NAP Client configuration utility tool
  • SERVICES.MSC: opens Service manager
  • TASKSCHD.MSC or CONTROL SCHEDTASKS: opens Schedule Tasks manager
  • GPEDIT.MSC: opens Group Policy utility tool
  • LUSRMGR.MSC: opens Local Users and Groups
  • SECPOL.MSC: opens local security settings
  • CIADV.MSC: opens indexing service
  • NTMSMGR.MSC: removable storage manager
  • NTMSOPRQ.MSC: removable storage operator requests
  • WMIMGMT.MSC: opens (WMI) Window Management Instrumentation
  • PERFMON or PERFMON.MSC: opens the Performance monitor
  • MMC: opens empty Console
  • MDSCHED: opens memory diagnostics tools
  • DXDIAG: opens DirectX diagnostics tools
  • ODBCAD32: opens ODBC Data source Administrator
  • REGEDIT or REGEDT32: opens Registry Editor
  • DRWTSN32: opens Dr. Watson
  • VERIFIER: opens Driver Verifier Manager
  • CLICONFG: opens SQL Server Client Network Utility
  • UTILMAN: opens Utility Manager
  • COLORCPL: opens color management
  • CREDWIZ: back up and recovery tool for user passwords
  • MOBSYNC: opens Synchronization center
  • MSCONFIG: opens System Configuration Utility
  • SYSEDIT: opens System Configuration Editor (careful while using this command)
  • SYSKEY: Windows Account Database Security management (careful while using this command)


Windows utility and applications

  • EPLORER: Opens windows Explorer
  • IEXPLORER: Opens Internet explorer
  • WAB: opens Contacts
  • CHARMAP: opens Character Map
  • WRITE: opens WordPad
  • NOTEPAD: opens Notepad
  • CALC: opens Calculator
  • CLIPBRD: opens Clipbook Viewer
  • WINCHAT: opens Microsoft Chat Interface
  • SOUNDRECORDER: opens sound recording tool
  • DVDPLAY: run CD or DVD
  • WMPLAYER: opens Windows Media Player
  • MOVIEMK: Opens untitled Windows Movie Maker
  • OSK: opens on-screen Keyboard
  • MAGNIFY: opens Magnifier
  • WINCAL: opens Calendar
  • DIALER: opens phone Dialer
  • EUDCEDIT: opens Private Character Editor
  • NDVOL: opens the mixer volume
  • RSTRUI : opens Tool System Restore (For Vista only)
  • %WINDIR%\SYSTEM32\RESTORE\rstrui.exe: opens Tool System Restore (for XP only).
  • MSINFO32: Opens the System Information
  • MRT : launches the utility removal of malware.
  • Taskmgr : Opens the Windows Task Manager
  • CMD: opens a command prompt
  • MIGWIZ: Opens the tool for transferring files and settings from Windows (Vista only)
  • Migwiz.exe: Opens the tool for transferring files and settings from Windows (for XP only)
  • SIDEBAR: Open the Windows (Vista only)
  • Sigverif : Opens the tool for verification of signatures of files
  • Winver : Opens the window for your Windows version
  • FSQUIRT: Bluetooth Transfer Wizard
  • IExpress opens the wizard for creating self-extracting archives. Tutorial HERE
  • MBLCTR: opens the mobility center (Windows Vista only)
  • MSRA : Opens the Windows Remote Assistance
  • Mstsc : opens the tool connection Remote Desktop
  • MSDT: opens the diagnostic tools and support Microsoft
  • WERCON: opens the reporting tool and solutions to problems (for Vista only)
  • WINDOWSANYTIMEUPGRADE: Enables the upgrade of Windows Vista
  • WINWORD : opens Word (if installed)
  • PRINTBRMUI : Opens migration wizard printer (Vista only)


Disk management

  • DISKMGMT.MSC: opens disk management utility
  • CLEANMGR: opens disk drive clean up utility
  • DFRG.MSC: opens disk defragmenter
  • CHKDSK: complete analysis of disk partition
  • DISKPART: disk partitioning tool


Connection management

  • IPCONFIG: list the configuration of IP addresses on your PC (for more information type IPCONFIG/? in the CMD menu)
  • INETCPL.CPL: opens internet properties
  • FIREWALL.CPL: opens windows firewall
  • NETSETUP.CPL: opens network setup wizard


Miscellaneous commands

  • JAVAWS: View the cover of JAVA software (if installed)
  • AC3FILTER.CPL: Opens the properties AC3 Filter (if installed)
  • FIREFOX: Mozilla launches Firefox (if installed)
  • NETPROJ: allow or not connecting to a network projector (For Vista only)
  • LOGOFF: closes the current session
  • SHUTDOWN: shut down Windows
  • SHUTDOWN-A: to interrupt Windows shutdown
  • %WINDIR% or %SYSTEMROOT%: opens the Windows installation
  • %PROGRAMFILES%: Opens the folder where you installed other programs (Program Files)
  • %USERPROFILE%: opens the profile of the user currently logged
  • %HOMEDRIVE%: opens the browser on the partition or the operating system is installed
  • %HOMEPATH%: opens the currently logged user C: \ Documents and Settings \ [username]
  • %TEMP%: opens the temporary folder
  • VSP1CLN: deletes the cache for installation of the service pack 1 for Vista
  • System File Checker (Requires Windows CD if the cache is not available):
    • SFC / scannow: immediately scans all system files and repairs damaged files
    • SFC / VERIFYONLY: scans only those files system
    • SFC / Scanfil = "name and file path": scans the specified file, and repaired if damaged
    • SFC / VERIFYFILE = "name and file path": Scans only the file specified
    • SFC / scanonce: scans the system files on the next restart
    • SFC / REVERT: return the initial configuration (For more information, type SFC /? In the command prompt CMD.







Friday, September 18, 2009

Run Update.exe to Install Windows XP SP1

To install the service pack, follow these steps.

NOTE: Windows XP must be installed on the computer to use this method.
  1. Disable any real-time antivirus programs that are running on the computer.
  2. Connect to the shared distribution folder that contains the service pack source files.
  3. In the Update folder, run Update.exe.

    For example, to install the service pack from the E:\XPSP1\I386 folder, type the following at the command prompt, and then press ENTER:
    e:\xpsp1\i386\update\update.exe
  4. When the installation is complete, restart the computer, and then restart the antivirus programs that you disabled in step 1.

Create and Prepare the I386 Distribution Folder

  1. Connect to the network or computer on which you want to create the I386 distribution folder.
  2. In a shared folder, create an I386 folder from which to distribute the service pack. For example, to create the I386 folder in a folder named XPSP1, type the following at the command prompt (where drive is the drive of the network or computer where the distribution folder is located), and then press ENTER:
    mkdir drive:\xpsp1\I386
  3. Extract Xpsp1.exe to the I386 folder that you created in step 2. To do this, type the following at the command prompt (where path is the location of the shared distribution folder), and then press ENTER:
    xpsp1.exe /x:path /u
    For example, to extract Xpsp1.exe to the E:\XPSP1\I386 folder, type the following at the command prompt, and then press ENTER:
    xpsp1.exe /x:e:\xpsp1\i386 /u
  4. Copy all the files that are contained in the I386\New and I386\Ip folders to the I386 folder. To do this, switch to the I386 folder, type the following at the command prompt, and press ENTER after each command:
    copy new
    copy ip
    For example, to copy all of the files in the E:\XPSP1\I386\New folder and E:\XPSP1\I386\Ip folder to the E:\XPSP1\I386 folder, type the following at the command prompt, and press ENTER after each command:
    e:
    cd xpsp1\i386
    copy new
    copy ip
  5. At the command prompt, type exit, and then press ENTER.

Friday, August 21, 2009

Debug a Windows XP batch file and output the current date and time to a log file

The Windows 2003 Resource Kit comes with a batch file command, logtime, that lets you output the current time, date, and a custom text message to a log file. This is great for benchmarking batch files and commands in that you can output when such a command starts and completes.

To run logtime, first download and install the Windows Server 2003 Resource Kit using the instructions mentioned in MalekTips (check the other Windows XP and DOS command tips).

Once the Resource Kit is installed, to view the online help for logtime:

C:\>logtime /?

To write a message to the text file "logtime.log" in the current directory, just issue this command:

C:\>logtime "MESSAGE"

For example, the following command will write the current day, time, and message "Command just completed" to the file logtime.log:

C:\>logtime "Command just completed"

Note that this will display the results of the command to the standard output as well. To hide this:

C:\>@logtime "Command just completed" > nul

XP: kill a Windows process from the command line with taskkill


The ability to perform tasks from a system’s command line allows those tasks to be used in batch files. This recipe describes several uses of taskkill to terminate Windows processes.

If you know the name of a process to kill, for example notepad.exe, use the following command from a command prompt to end it:

taskkill /IM notepad.exe


This will cause the program to terminate gracefully, asking for confirmation if there are unsaved changes. To forcefully kill the same process, add the /F option to the command line. Be careful with the /F option as it will terminate all matching processes without confirmation.To kill a single instance of a process, specify its process id (PID). For example, if the desired process has a PID of 827, use the following command to kill it:

taskkill /PID 827


Using filters, a variety of different patterns can be used to specify the processes to kill. For example, the following filter syntax will forcefully kill all processes owned by the user Quinn:

taskkill /F /FI “USERNAME eq Quinn”


The following table shows the available filters and their use.

Filter Name Valid Operators Valid Value(s)
———– ————— ————–
STATUS eq ne RUNNING | NOT RESPONDING
IMAGENAME eq ne Image name
PID eq ne gt lt ge le PID value
SESSION eq ne gt lt ge le Session number.
CPUTIME eq ne gt lt ge le CPU time in the format
of hh:mm:ss.
MEMUSAGE eq ne gt lt ge le Memory usage in KB
USERNAME eq ne User name in [domain\]user
format
MODULES eq ne DLL name
SERVICES eq ne Service name
WINDOWTITLE eq ne Window titleeq: equals ne: not equal
gt: greater than lt: less than
gt: greater than or equal le: less than or equal

WindowsXP: Using the Command prompt to see and kill processes

If you are a WindowsXP user then you must be already familiar with the life-saving graphical tool called “Task Manager” on Windows. Whenever the PC starts hanging and the processes start eating up a lot of memory (Sadly most of the time its Firefox for me), we press the alt+ctr+del key to bring up the the “Task Manager” and try to kill the memory eating processes and the ones which are “not responding”. Well, you should also know that this can be done efficiently from the command prompt as well.

As my project work requires writing and running codes, I generally have at least one Windows command prompt open. If this is the case with you then it is much faster to manage your windows processes from command prompt than to open up the Task Manager, just like we do on Linux using “ps” and “kill” command. Get to know the following commands and you can easily use the command prompt to see and kill processes.

1. Tasklist : This command is similar to “ps” command on Linux and is used to see the details of the programs and processes that are running in Windows. Tasklist can be applied to see how much memory and CPU time running processes are using, what DLL files they rely on, and other information. Thus it can be a very useful troubleshooting tool.

  • Processes info: When you enter tasklist on the command prompt, you can see the following informations by default. Image Name, PID, Session Name, Session#, Mem Usage
  • Processes detailed info: Additional info like, Status, User Name, CPU Time, Window Title can be displayed using tasklist /v
  • Services and Processes info: Use tasklist /svc to get a table relating Image Name, PID, and Services, very useful to know the relationship between a process and the services that are running on a system.
  • dlls and Processes info: Tasks and Use tasklist /m to find which DLLs are used by each process.
  • Filtering processes: Processes can be filtered using ImageName, PID, MemUsage, Status, Username and WindowTitle. For Example,
    • Use the following command to to find processes that are not responding.
      • tasklist /fi "status eq not responding"
    • Use the folliwing to list the processes eating up more than 10MB.
      • tasklist /fi "memusage gt 10000"
  • More Info: To get more info on advanced syntax of the command use tasklist /? or refer to Microsoft’s documentation.

(NOTE: Although Tasklist is a part of Windows XP Professional, it does not come with the Home edition. Those with the Home version of XP can download this file and can put it in the system path.)

2. Tskill : This command is used to end a process, using its name of its PID.

  • Kill with name: Use tskill processname to kill a process with name processname. For example:
    • tskill winword (closes all the Microsoft documents that you have open)
  • Kill with PID : Similarly use tskill processid to kill a process with PID processid. Tasklist can be used to find the PID of a process.
  • More Info: To get more info on advanced syntax of the command use tskill /? or refer to Microsoft’s documentation.

(NOTE: Tskill is a part of both Windows XP Professional and the Home edition.)

3. Taskkill : Similar to Tskill, this command is also used to end a process but it provides us more options in doing so. Apart from specifying the PID or the image name of the process to kill, we can also use ceratin filters to kill the matching processes as explained below.

  • Kill with name: Use taskill /IM imagename to kill a process with the given Image name. For example:
    • taskkill /im notepad.exe /f (forces notepad to be killed.)
  • Kill with PID : Use taskill /PID processid to kill a process with the given processid.
  • Filtering Taskkill: Processes to be killed can be filtered using ImageName, PID, MemUsage, CPUTime, Session, Status, Username, WindowTitle, Services or Modules (dll). For Example,
    • Use the following command to forcefully shut down all the processes that are not responding.
      • taskkill /f /fi "status eq not responding"
    • Use the folliwing to close down all programs using more than 10 MB..
      • taskkill /f /fi "memusage gt 10000"
  • More Info: To get more info on advanced syntax of the command use taskkill /? or refer to Microsoft’s documentation.

(NOTE: Taskkill is only a part of Windows XP Professional.)