Friday, September 9, 2016

command line attach debugger to process

The one liner below will start debugging the IIS processes using Visual Studio. Instead of navigating to the menu using the mouse, Attach Process, check all processes, reverse sort process name, select all w3wp, attach.

(([System.Runtime.InteropServices.Marshal]::GetActiveObject("VisualStudio.DTE")).debugger.localprocesses | Where Name -Match "w3wp.exe").Attach()

This saves time, especially if you need to perform this action several times.

This could also be changed into a function

Function attachdebug

param ([Parameter(Mandatory=$true)][ValidateNotNull()]



(([System.Runtime.InteropServices.Marshal]::GetActiveObject("VisualStudio.DTE")).debugger.localprocesses | Where Name -Match $process).Attach()




attachdebug -Process w3wp.exe

Thursday, January 21, 2016

How I solved connection issue in my Hyper-V VM


Today I started a VM in Hyper-V. After I logged in to the VM using remote desktop, I noticed that I had no internet connectivity.

To solve this, I just restarted the ICS on the host system.

Below are the PowerShell commands to do so:

get-service sharedaccess | stop-service

get-service sharedaccess | start-service

Now it works fine.