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()]
[String]$Process)
If($process){
(([System.Runtime.InteropServices.Marshal]::GetActiveObject("VisualStudio.DTE")).debugger.localprocesses | Where Name -Match $process).Attach()
}
}
Use:
attachdebug -Process w3wp.exe