Wednesday, September 17, 2014

Disconnect users' RDP connection from a remote server

Sometimes you get the message "too many users connected", or you just want to disconnect a hanging session of yourself, and can't access the remote servers desktop, command line tools exist :

To check how many users are connected (and get the session Id of the session you want to kick:

qwinsta /server:[server name/ip]

This will show a list containing sessionname, username, id, etc. 
It's the Id we need for the next step :

rwinsta /server:[server name/ip]  [SessionId]

If you have the necessary rights the session will then be disconnected.

Tuesday, March 4, 2014

Force windows 7 to use Wired LAN connections over wifi connections

I noticed on my Windows 7 pc that the pc connects to WiFi even when connected by a wired LAN. This causes some inconveniences, so I had to find how to turn it of.
To make sure windows 7 prefers LAN, follow these steps :


  • Open the control panel
  • Click Network and Internet
  • Network and Sharing Center
  • (left) Change Adapter Settings
  • Hold the Alt key to make the menus appear and click Advanced
  • Click Advanced settings
  • On the Adapters and Binding tabs :
  • Select the Local Area Connection (names might differ)
  • Push the up arrow next to the list until the Local Area Connection is first in the list













Now just click OK and close all opened screens. Reboot might be needed. 

Tuesday, February 11, 2014

Formatting all files in a solution in Visual Studio

When I had to format all files in a solution,
all I could find at first were macros. Since Visual Studio 2012 doesn't have the macro explorer anymore,
I had to find an other way to accomplish this.

Thanks to this github page I found the follow code that accomplishes just what I need.
Open the Nuget package manager console and paste in (2 lines) :

function f($projectItems) { $projectItems | ? { $_.Name.EndsWith( ".cs" ) } | % { $win = $_.Open('{7651A701-06E5-11D1-8EBD-00A0C90F26EA}') ; $win.Activate() ; $DTE.ExecuteCommand('Edit.FormatDocument') } ; if ($projectItems) { $projectItems | % { f($_.projectItems) } } }

$dte.Solution.Projects | % { f($_.ProjectItems) }
Thanks JayBazuzi!