Wintellect Blogs

New WintellectPowerShell Version with Visual Studio 2017 Support

John Robbins

18 Jan , 2017  

We have a new version of Visual Studio coming soon so I did the work to update my WintellectPowerShell module to support it. And, what a huge adventure that turned out to be! I will discuss why its support for Visual Studio 2017 was hard a bit later in this blog entry. For those of you who are new to WintellectPowerShell, it is a module that brings a number of useful cmdlets for setting up symbol and source servers for Visual Studio 2013-2017 as well as WinDBG. Other cmdlets automatically download and extract all the lovely goodness of the SysInternal tools, automate the analysis of lots of minidump files, and so on. The module has been helpful to me over the years. You can look at all the source code on GitHub: https://github.com/Wintellect/WintellectPowerShell. To install WintellectPowerShell directly, execute the following command in PowerShell:

  1. Install-Module -Name WintellectPowerShell -Scope CurrentUser

If you have a previous version of WintellectPowerShell installed, you will see an ‘Authenticode issuer’ error when you try to update. The error is because since I last released a WintellectPowerShell build, my code signing certificate needed to be renewed. When PowerShellGet does checks a signed module, it checks all the certificate fields.… Read more

News

Azure PowerShell 1.0 and Azure Portal Enhancements Released

Paul Ballard

25 Nov , 2015  

Microsoft has released the 1.0 version of the Azure PowerShell cmdlets for automating processes with Azure including better support for Resource Manager, VM disk encryption with Azure Vault, and inclusion of Azure Data Lake and Notification Hub cmdlets.  Also released were new user experience improvements in the Azure Preview Portal such as notification enhancements and adding Marketplace access directly in the New menu.

Azure PowerShell 1.0 includes the following items from the Azure Blog.

  • Enable better support for Azure Resource Manager cmdlet use side by side with Azure Service Management cmdlets in Azure Automation. While Resource Manager cmdlets don’t ship out of the box in Azure Automation yet, they will soon. Until then, they can be imported manually as described here. Please follow Azure Automation for updates on when the modules will ship out of the box.
  • Separate Azure Service Management and Resource Manager functionality to provide clarity regarding features of Azure the cmdlets target
  • Enforce semantic versioning and ensure cmdlets authored against a given major version of Azure PowerShell will not encounter breaking changes from updates to Azure PowerShell
  • Availability of Azure PowerShell through WebPI and PowerShell Gallery to enable quicker delivery of new features and defect resolutions
  • Improvements in the Azure PowerShell documentation and continued focus on documentation
  • Certificate Authentication Support for Azure Resource Manager
  • Virtual Machine disk encryption through Azure Key Vault
  • Introduction of Azure Data Lake and Notification Hub cmdlets
  • Improvements for Resource Manager, Web Apps and many other Azure services

For more information including installation instructions and how to get started with Azure PowerShell 1.0, check out their blog post.… Read more

,

Wintellect Blogs

WintellectPowerShell Now on the PowerShell Gallery

John Robbins

7 Nov , 2015  

Getting and installing modules is easier than ever with the PowerShell Gallery and PowerShellGet. Instead of downloading and extracting files into your PowerShell modules directory, a simple call to Install-Module takes care of everything for you. Today I’ve published my WintellectPowerShell module. Now you can install and get started setting up Visual Studio to access symbol server, source servers, and many other cmdlets for debugging support. All you need to do with PowerShell 5.0 (or by adding the Package Management Preview to PowerShell versions 3 or 4) is issue the following command:

  1. Install-Module -Name WintellectPowerShell -Scope CurrentUser

 

If you haven’t heard of WintellectPowerShell, here are all the commands it offers.

TOPIC
about_WintellectPowerShell

SHORT DESCRIPTION
Provides cmdlets for setting up symbol servers and other
functionality related to debugging and performance tuning.

LONG DESCRIPTION
This module makes setting up symbol servers and source server debugging
functionality easier to control for Visual Studio 2010 through 2015
and WinDBG. Setting up a development machine for symbol server
access is more difficult than it needs to be but no more.

You can have any combination of Visual Studio 2010 through 2015, and
WinDBG on the computer for these cmdlets to work.

These cmdlets had been originally developed as PowerShell scripts by John
Robbins and released on his blog.

Read more

, ,

Wintellect Blogs

Automating Analyzing Tons of Minidump Files with WinDBG and PowerShell

John Robbins

5 May , 2015  

When debugging a nasty problem in your code, one of the most helpful things you can get is a minidump. With that picture of what your app was doing at the time of the crash, hang, or when the memory started spiking, you’ve got a big hint to jumpstart your exploring. While there’s a bunch of tools out there, such as the wonderful ProcDump, and the debuggers themselves to create minidumps, the real moment of truth is when you have to look at those minidump. That’s easy to do with one or two, but what happens if you have 200? In my line of work, where I debug other’s software problems (and will be glad to help you with yours), I’m routinely faced with hundreds of dumps from a client. As much as I would like to carefully open each minidump and lovingly type the same commands over and over for the greatest consulting billing statement ever, I just can’t get my clients to pay for that.

What I really need is a way to say, “Here’s a bunch of .DMP files; go run these WinDBG commands across all of them.” It turns out that accomplishing that basic task is not hard at all when you combine a little WinDBG knowledge with a little PowerShell magic.… Read more

,

Wintellect Blogs

Single Stepping a PowerShell Pipeline

John Robbins

11 Dec , 2014  

As I was building up a moderately complicated pipeline in PowerShell, I was having some trouble and really wished there was a way to single step the pipeline so I could see the state of each item as it was processed. I wasn’t sure this was possible, but it is and I thought others might find it helpful. The magic is in the super powerful Set-PSBreakpoint cmdlet.

Because Set-PSBreakpoint can create breakpoints on not only lines and variable reads/writes, but also commands, I thought I’d try setting a breakpoint in the PowerShell console on one of the commands in the pipeline and it worked great! In the example below I will set a breakpoint on the Get-ChildItem cmdlet and when the breakpoint is hit, use the command line debugger to step through parts of the pipeline (the ‘s’ command is step into)

  1. PS C:\Junk> Set-PSBreakpoint -Command Get-ChildItem
  2.   ID Script   Line Command        Variable    Action
  3.   — ——   —- ——-        ——–    ——
  4.    0               Get-ChildItem
  5. PS C:\Junk> Get-ChildItem *.exe | ForEach-Object { $_.Name }
  6. Entering debug mode. Use h or ? for help.
  7. Hit Command breakpoint on ‘Get-ChildItem’
  8. At line:1 char:1
  9. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  10. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. [DBG]: PS C:\Junk>> s
  12. At line:1 char:38
  13. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  14. +                                      ~
  15. [DBG]: PS C:\Junk>> s
  16. At line:1 char:40
  17. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  18. +                                        ~~~~~~~
  19. [DBG]: PS C:\Junk>> s
  20. Foo.exe
  21. At line:1 char:48
  22. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  23. +                                                ~
  24. [DBG]: PS C:\Junk>>
Read more

,

Resources

Wintellect PowerShell Module

Paul Ballard

12 Oct , 2013  

PowerShell scripts for better debugging and life! This module provides cmdlets for setting up symbol servers and other functionality related to debugging. This module makes setting up symbol servers and source server debugging functionality easier to control for Visual Studio 2010, Visual Studio 2012 and WinDBG. Setting up a development machine for symbol server access is more difficult than it needs to be but no more.
Read more

Wintellect Blogs

Visual Studio vs. the PowerShell Command Line

John Robbins

9 May , 2013  

Numerous times in the last month I’ve been working with different teams and when I whip out my PowerShell window and start doing all the magic, especially with Visual Studio command line tools, the young kids go crazy. The mix of command line development tools and PowerShell is a powerful aphrodisiac. Too bad that Visual Studio is living in the dark ages of batch files required to set various environment variables so everything works. The trick is getting those environment variables into PowerShell, which is not as easy as it should be.

For command line work, there’s two key batch files from Visual Studio that do the environment variables dance. The first is <VS Install Dir>\VC\VCVARSALL.BAT, which does the work to set up the PATH, LIB, INCLUDE, and other key environment variables. This is the batch file run when opening the Visual Studio Developer Command prompt and the other flavors of command prompts for ARM, cross compilers, etc. The second batch file is <VS Install Dir>\Team Tools\Performance Tools[\x64\]VSPerfCLREnv.cmd that you use to do command line profiling and code coverage, which again involves setting the PATH but also the key profiling environment variables that start with COR_*.

What we need is a seamless way to execute batch files so any environment variables that are added or removed automatically reflected in the PowerShell window.… Read more

Wintellect Blogs

WintellectPowerShell: Create NGEN PDBs for Easier Profiling on Win8/Server 2012

John Robbins

26 Feb , 2013  

When sampling profiling on Windows 8 or Server 2012, nothing looks different in Visual Studio 2012, but the entire insides of the profiling collector is completely changed. With the profiler now based on Event Tracing for Windows (ETW) everything is spiffy but PDB files are more important than ever. While I’m sure you are all using the Symbol Servers and have all symbols for the code you build, what about the binaries you didn’t build and was built on the server/user’s machine?

If you’re installing binaries in the Global Assembly Cache or running Native Generation (NGEN) to pre-JIT your binaries, that code generation is done on each machine so each machine has a unique copy of the binary. When profiling, you need the PDB files for those unique binaries to see the JIT’d methods show up in the sampling profiling. You’re probably thinking you are safe that since you are not putting anything in the GAC you can stop reading now. Sadly you have to keep reading because the .NET Framework itself is NGEN’d on each install so if you want to see where your calls into the .NET Framework are eating your time, you need to get those PDBs from that machine.… Read more

Wintellect Blogs

Batch Updating/Changing Visual Studio Projects with PowerShell

John Robbins

28 Jan , 2013  

Working on a giant codebase recently, I needed to check if all C# projects had Code Analysis turned on for all configurations. Given there were easily 30 to 40 different .CSPROJ files I was so not looking forward to manually going through them all one at a time in Visual Studio to check. The .CSPROJ files are just XML files and PowerShell handles XML great, so 10 minutes of messing around and I had a nice one-liner that reported all the .CSPROJ file names and which configurations didn’t have Code Analysis enabled.

dir -Recurse *.csproj | `
    ForEach-Object { Write-Host $_.FullName; (Get-Content $_)} | `
        ForEach-Object { $_.Project.PropertyGroup } | `
            Where-Object { ($_.Condition -ne $null) -and `
                           (($_.RunCodeAnalysis -eq $null) -or `
                           ($_.RunCodeAnalysis -eq "false"))} | `
                ForEach-Object { Write-Host $_.Condition does not have CodeAnalysis turned on}

In the code above, I added a lot of line continuation characters so it was easier to read in the blog. Even if you haven’t done much PowerShell, it should be pretty easy to follow. Because PowerShell loves you, declaring a variable as means you get the automatic properties for elements and XML is a piece of cake. PowerShell for the win!

So now I have all the projects that need to be updated, but I still have to do that manually.… Read more

Wintellect Blogs

Find File and Directory Names FAST

John Robbins

27 Jan , 2013  

For some reason, I always seem to be looking for file and directory names. Since desktop search is a GUI and I’m a command line kind of guy, I got tired of waiting on PowerShell to slowly grind through the file system on its single thread. With lots of cores and an SSD, I shouldn’t be waiting on simple file finds! On a plane trip I threw together this command line tool to speed up my file finding and give me an extra five seconds each day I used to spend waiting on file searches to finish. This little program scratched my itch and maybe someone will find it useful.

You can search with wild cards as well as regular expressions and for as many patterns as you want. It will also handle directory names if you want. Yes, it’s a full featured fast file finder. Here are all the command line flags and usage instructions:

FF 1.0.0.0
(c) 2012, John Robbins/Wintellect – john@wintellect.com
Find file and directory names fast!

Usage:
FF [-regex] [-includedir] [-nostats] [-path <directory>] pattern*

-regex            – Treat the patterns as regular expressions. The default
                    follows DOS wildcard usage. Make sure to use regex values
                    in patterns with this flag.

Read more