Thursday, December 18, 2014

How to Create a bootable Windows 2012 R2 USB Disk? (applies to Windows 8.1 also)

Pre-requisites: 7-Zip software (Download it from here: http://7-zip.org/), Windows 2012 (R2) ISO (or Windows 8.1 ISO), 8GB or more USB disk
  • Open Command Prompt in elevated mode (Run as Administrator)
  • Type diskpart and press Enter
  • Type list disk and press Enter. Note the list of existing disks.
  • Insert the USB Disk
  • Type list disk and press enter again. Note the new disk showed up which is our USB disk. I assume the new disk is 2 for example purpose.
  • Type select disk X where X is your USB disk. E.g., select disk 2. Press Enter.
  • Type clean and press enter.
  • Type create partition primary and press enter to create primary partition 1.
  • Type select partition 1 and press enter.
  • Type active and press enter to make the partition 1 active
  • Type format fs=ntfs and press enter. This will format the partition 1 as NTFS volume.
  • Type assign and press enter to assign the USB disk to a drive letter.

  • Now right click on Windows Server 2012 R2 or Windows 8.1 ISO file, select 7-Zip –> Extract Files…
  • Select your USB disk to extract the ISO contents to the USB disk
That’s all. Boot the server or computer using the bootable USB disk.

How to logoff remote desktop sessions via command line tools?

Query the Remote Server for Current Terminal Sessions


To query and list the sessions on the remote session, you could use QUser.exe or QWinsta
1. QUser
QUser command comes with all the latest Windows clients and servers. This will list the sessions
of the remote server (or local machine).
NOTE: if you are using Windows XP, you need to add this location into your System path:
C:\WindowsSystem32DLLCache. To do this, in command prompt, type the following.
SET PATH = %PATH%;C:WindowsSystem32DLLCache;
QUser help shows,
C:\Anand>QUser /?
Display information about users logged on to the system.
QUERY USER [username | sessionname | sessionid] [/SERVER:servername]
username Identifies the username.
sessionname Identifies the session named sessionname.
sessionid Identifies the session with ID sessionid.
/SERVER:servername The server to be queried (default is current).
E.g.,
C:>quser /server:MyCitrixSVR
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
johndoe ica-tcp#966 10 Active 7 7/31/2008 3:04 PM
averagejoe ica-tcp#969 1 Active 9 7/31/2008 3:30 PM
familyman ica-tcp#984 5 Active 1:06 7/31/2008 4:33 PM
normaldude ica-tcp#987 2 Active 4 7/31/2008 6:20 PM


2. QWinsta
QWinsta is liLle different and beLer. It has more features and options. It comes with all flavors of
Windows. QWinsta command line help displays as,
C:>qwinsta /?
Display information about Terminal Sessions.
QUERY SESSION [sessionname | username | sessionid]
[/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER]
sessionname Identifies the session named sessionname.
username Identifies the session with user username.
sessionid Identifies the session with ID sessionid.
/SERVER:servername The server to be queried (default is current).
/MODE Display current line seLings.
/FLOW Display current flow control seLings.
/CONNECT Display current connect seLings.
/COUNTER Display current Terminal Services counters information.
E.g.,
C:>qwinsta /server:citrixserver
SESSIONNAME USERNAME ID STATE TYPE DEVICE
0 Disc rdpwd
ica-tcp 65536 Listen wdica
rdp-tcp 65537 Listen rdpwd
console 16 Conn wdcon
ica-tcp#966 johndoe 10 Active wdica
ica-tcp#969 apple 1 Active wdica
ica-tcp#984 averagejoe 5 Active wdica
ica-tcp#987 familyman 2 Active wdica
ica-tcp#989 whoisme 3 Active wdica
You are welcome to try the other options QWinsta provides.


Logoff the Remote Sessions


To Log off the terminal session of the remote server, you can use any one of two command line
tools. One of LOGOFF and another one is RWINSTA. Before you log off the remote session, you
should know the ʺSession IDʺ which you get it from ʺQUSERʺ OR ʺQWINSTAʺ commands as
above stated.


1. Logoff
Logoff command kicks off (logging off) the specified remote session. Log off help shows,
C:>logoff /?
Terminates a session.
LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V]
How to logoff remote desktop sessions via command line tools? | ..:::: … http://anandthearchitect.wordpress.com/2008/08/01/how-to-logoff-remo…
3 of 7 02/26/2013 05:20 PM
sessionname The name of the session.
sessionid The ID of the session.
/SERVER:servername Specifies the Terminal server containing the user
session to log off (default is current).
/V Displays information about the actions performed.
E.g.,
C:>logoff /server:infra-apps 1 /v
Logging off session ID 1


2. RWinsta
RWinsta has same parameters and does same thing as log off command. It simply means Reset
Windows STAtion. The help goes as,
C:>RWinsta /?
Reset the session subsytem hardware and soOware to known initial values.
RESET SESSION {sessionname | sessionid} [/SERVER:servername] [/V]
sessionname Identifies the session with name sessionname.
sessionid Identifies the session with ID sessionid.
/SERVER:servername The server containing the session (default is current).
/V Display additional information.
E.g.,
C:>RWinsta /Server:MyWinServer 1
Note: RWinsta command does not return anything.
Happy Re-seLing the remote sessions.