Wednesday, June 15, 2011

Some useful commands

Determining which application is using which port

To determine which application is using which port, use the tasklist command line tool along with the PID information from the netstat tool.
  1. On the server, click Start, click Run, type cmd, and then click OK.
  2. Type tasklist /svc and then press ENTER.
  3. Look for an entry for the PID number that is associated with the port (from the netstat output). The services or processes associated with that PID will appear on the right.
Checking installed product name and version of a particular application

Open Command Prompt and execute the following command:

wmic product where "Name like '%<product name>%'" get Name, Version

Here the below command will check the installed version of Citrix Online Plugin.
wmic product where "Name like '%citrix online%'" get Name, Version


List all installed Microsoft products

Open Command Prompt and execute the following command.
wmic product where "Vendor like '%Microsoft%'" get Name, Version
Saving WMI output to a file
To save the wmic output to a file, you can use the /output and(optionally) /format parameters, e.g.:

wmic /output:software.txt product get Name, Version
wmic /output:software.htm product get Name, Version /format:htable

Query user session on Terminal Server
query session /server:<server name>

Reset user session on Terminal Server
First query the user session to get the session ID using the command query session /server:<server name>

Once you get the ID, to reset that ID execute the following command.

reset session <ID> /server:<server name>


No comments:

Post a Comment