Tag Archives: command line

Windows: Howto terminate a RDP Session remotely by command line

Hi,

when a RDP sessions hangs there are multiple ways to destroy it. The command line way:

Identify the RDP Session ID. Use quser


C:\>quser /Server:YourWindowsServer
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
 winuser               rdp-tcp#6           2  Active          3  24.09.2014 22:26

Continue reading Windows: Howto terminate a RDP Session remotely by command line

Advertisment to support michlstechblog.info

Windows: Determine uptime from command line

Hi,

unlike Linux, Windows has no builtin uptime command to see when the operating system starts.

But nevertheless it’s possible. Use the systeminfo command.


c:\> systeminfo | findstr /i time
System Boot Time:          05.06.2014, 21:05:06
Time Zone:                 (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna

Note: If you have installed a language different then english replace time as filter which applies to your language.

Michael

Windows: Enable or disable Features from command line

Hi,

some usefull tools like telnet.exe are disabled by default in Windows Vista and later version. You can enable this and other features by command line using dism.
dism called with the get-features parameter lists all available features and its current state.
Note: Featurenames are case sensitive.
C:\>dism /online /Get-Features

.....
Feature Name : TelnetServer
State : Disabled

Feature Name : TelnetClient
State : Enabled
......

and the Enable-Feature option install them
Continue reading Windows: Enable or disable Features from command line

Windows: Show and configure network settings using netsh

Hi,

here is a set of netsh command lines which I use very often.

Show Interface configuration

netsh interface ipv4 show config

Only IP Addresses of all LAN adapters

netsh interface ipv4 show address

Show global TCP/IP Parameters

netsh interface ipv4 show global

Disable and enable a Interface

netsh int set int name="ethernet" admin=disabled
netsh int set int name="ethernet" admin=enabled

Show all network  interfaces and its link state

netsh interface ipv4 show interfaces
Continue reading Windows: Show and configure network settings using netsh

Windows: Changing the power plan or a single value in a sheme

This posts descripes how to change the power plan in Windows or a single option in a sheme from the Windows command line.

First of all start a cmd command shell  with administrator rights.

To get a list of all available shemes run


c:\> powercfg /L


Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced) *
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a  (Power saver)

The most options to powercfg at the command line must be specified with the GUID. To set the “High performance” plan active determine the sheme  GUID and execute

c:\> powercfg /S 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Query again und you see the other plan is active

c:\> powercfg /L
Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance) *
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a  (Power saver)

Let us supose we only want to modify a single option or value. For example, disable the “Allow hybrid sleep” value in sheme “Power Saver” and with AC power active. Then, you first have to query all of the content of a sheme, because we need the GUID as parameter for powercfg. The output is a long list of options, I redirect them in  a temporary file, because in the file it is easier to search for the necessary GUIDs.
Continue reading Windows: Changing the power plan or a single value in a sheme