Updated PowerShell Scripts to Manage Symbol Server and Source Server Settings

With Dev 11 Beta now in our hot little hands, I needed to update my symbol server and source server PowerShell scripts that automate setting up a developer machine. I’ve packaged up all the scripts previously published on this blog into a module, WintellectPowerShell, to make the cmdlets easier to use.

To set up a development machine to use a symbol server, use the Set-SymbolServer command. It takes care of setting the _NT_SYMBOL_PATH environment variable, as well as Visual Studio 2010 and Dev 11 Beta provided they are installed. The Set-SourceServer command sets up both VS 2010 and Dev 11, but also will set the _NT_SOURCE_PATH environment variable so WinDBG can pick up the source from your version control system as well. Yes, you C++ folks, these scripts support you as well!

I’ve also included an update version of my Get-SysinternalsSuite script that will download and extract all the wonderful Sysinternals tools. My previous version of the script relied on an external zip tool, but now used the Shell’s zip provider. There are a few other commands in the module for getting the current symbol server and source server values. The help is shown below and the download is here.

As always let me know if you find any bugs or have suggestions!

No discussion of PowerShell would be complete without a one-liner that does a lot. I wanted to show the help in this post so you could see all the commands. Once you have a module loaded, you can get the help simply by doing the following:

  1. (get-module WintellectPowerShell).ExportedFunctions.Keys | sort | foreach-object { Get-Help detailed $_}

I thought that was pretty cool!

  1. NAME
  2.     Expand-ZipFile
  3. SYNOPSIS
  4.     Expands a .ZIP file to the specified directory.
  5. SYNTAX
  6.     Expand-ZipFile [-ZipFile] <String> [-Destination] <String> [<CommonParameters>]
  7. DESCRIPTION
  8.     Using no external ZIP utilities, expands a .ZIP file to a specified directory.
  9. PARAMETERS
  10.     -ZipFile <String>
  11.         The .ZIP file to expand.
  12.     -Destination <String>
  13.         The output directory for the ZipFile. If this directory does not exist, it will
  14.         be created.
  15. NAME
  16.     Get-SourceServer
  17. SYNOPSIS
  18.     Returns a hashtable of the current source server settings..
  19. SYNTAX
  20.     Get-SourceServer [<CommonParameters>]
  21. DESCRIPTION
  22.     Returns a hashtable with the current source server directories settings
  23.     for VS 2010, Dev 11 Beta, and the _NT_SOURCE_PATH enviroment variable used
  24.     by WinDBG.
  25. NAME
  26.     Get-SourceServerFiles
  27. SYNOPSIS
  28.     Prepopulate your symbol cache with all your Source Server extracted source
  29.     code.
  30. SYNTAX
  31.     Get-SourceServerFiles [-CacheDirectory] <String> [[-SrcTool] <String>] [<CommonParameters>]
  32. DESCRIPTION
  33.     Recurses the specified symbol cache directory for PDB files with Source Server
  34.     sections and extracts the source code. This script is a simple wrapper around
  35.     SRCTOOl.EXE from the Debugging Tools for Windows (AKA WinDBG). If WinDBG is in
  36.     the PATH this script will find SRCTOOL.EXE. If WinDBG is not in your path, use
  37.     the SrcTool parameter to specify the complete path to the tool.
  38. PARAMETERS
  39.     -CacheDirectory <String>
  40.         The required cache directory for the local machine.
  41.     -SrcTool <String>
  42.         The optional parameter to specify where SRCTOOL.EXE resides.
  43. NAME
  44.     Get-SymbolServer
  45. SYNOPSIS
  46.     Returns a hashtable of the current symbol server settings.
  47. SYNTAX
  48.     Get-SymbolServer [<CommonParameters>]
  49. DESCRIPTION
  50.     Returns a hashtable with the current source server directories settings
  51.     for VS 2010, Dev 11 Beta, and the _NT_SYMBOL_PATH enviroment variable.
  52. NAME
  53.     Get-SysinternalsSuite
  54. SYNOPSIS
  55.     Gets all the wonderful Sysinternals tools
  56. SYNTAX
  57.     Get-SysinternalsSuite [-Extract] <String> [[-Save] <String>] [<CommonParameters>]
  58. DESCRIPTION
  59.     Downloads and extracts the Sysinternal tools to the directory you specify.
  60. PARAMETERS
  61.     -Extract <String>
  62.         The directory where you want to extract the Sysinternal tools.
  63.     -Save <String>
  64.         The default is to download the SysinternalsSuite.zip file and remove it after
  65.         extracting the contents. If you want to keep the file, specify the save
  66.         directory with this parameter.
  67. NAME
  68.     Get-Uptime
  69. SYNOPSIS
  70.     Returns how long a computer has been running.
  71. SYNTAX
  72.     Get-Uptime [[-computerName] <String>] [<CommonParameters>]
  73. DESCRIPTION
  74.     Returns the TimeSpan for how long a computer is running. If you’d like it
  75.     formatted you can use “Get-Uptime -f {0}”
  76. PARAMETERS
  77.     -computerName <String>
  78. NAME
  79.     Set-SourceServer
  80. SYNOPSIS
  81.     Sets the source server directory.
  82. SYNTAX
  83.     Set-SourceServer [-Directory] <String> [<CommonParameters>]
  84. DESCRIPTION
  85.     Sets the source server cache directory for VS 2010, Dev 11 Beta, and WinDBG
  86.     through the _NT_SOURCE_PATH environment variable to all reference the same
  87.     location. This ensures you only download the file once no matter which
  88.     debugger you use. Because this cmdlet sets an environment variable you
  89.     need to log off to ensure it’s properly set.
  90. PARAMETERS
  91.     -Directory <String>
  92.         The directory to use. If the directory does not exist, it will be created.
  93. NAME
  94.     Set-SymbolServer
  95. SYNOPSIS
  96.     Sets up a computer to use a symbol server.
  97. SYNTAX
  98.     Set-SymbolServer [-Internal] [-Public] [[-CacheDirectory] <String>] [[-SymbolServers] <String[]>] [-WhatIf] [-Confi
  99.     rm] [<CommonParameters>]
  100. DESCRIPTION
  101.     Sets up both the _NT_SYMBOL_PATH environment variable as well as Visual Studio
  102.     2010 and Dev 11 Beta (if installed) to use a common symbol cache directory as
  103.     well as common symbol servers.
  104. PARAMETERS
  105.     -Internal [<SwitchParameter>]
  106.         Sets the symbol server to use to http://SymWeb. Visual Studio will not use
  107.         the public symbol servers. This will turn off the .NET Framework Source
  108.         Stepping. This switch is intended for internal Microsoft use only.
  109.         You must specify either -Internal or -Public to the script.
  110.     -Public [<SwitchParameter>]
  111.         Sets the symbol server to use as the two public symbol servers from Microsoft.
  112.         All the appropriate settings are configured to properly have .NET Reference
  113.         Source stepping working.
  114.     -CacheDirectory <String>
  115.         Defaults to C:SYMBOLSPUBLICMicrosoftPublicSymbols for -Public and
  116.         C:SYMBOLSINTERNAL for -Internal.
  117.     -SymbolServers <String[]>
  118.         A string array of additional symbol servers to use. If -Internal is set, these
  119.         additional symbol servers will appear after HTTP://SYMWEB. If -Public is
  120.         set, these symbol servers will appear after the public symbol servers so both
  121.         the environment variable and Visual Studio have the same search order.
Stay Informed

Sign up for the latest blogs, events, and insights.

We deliver solutions that accelerate the value of Azure.
Ready to experience the full power of Microsoft Azure?

Atmosera is thrilled to announce that we have been named GitHub AI Partner of the Year.

X