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:
- (get-module WintellectPowerShell).ExportedFunctions.Keys | sort | foreach-object { Get-Help detailed $_}
I thought that was pretty cool!
- NAME
- Expand-ZipFile
- SYNOPSIS
- Expands a .ZIP file to the specified directory.
- SYNTAX
- Expand-ZipFile [-ZipFile] <String> [-Destination] <String> [<CommonParameters>]
- DESCRIPTION
- Using no external ZIP utilities, expands a .ZIP file to a specified directory.
- PARAMETERS
- -ZipFile <String>
- The .ZIP file to expand.
- -Destination <String>
- The output directory for the ZipFile. If this directory does not exist, it will
- be created.
- NAME
- Get-SourceServer
- SYNOPSIS
- Returns a hashtable of the current source server settings..
- SYNTAX
- Get-SourceServer [<CommonParameters>]
- DESCRIPTION
- Returns a hashtable with the current source server directories settings
- for VS 2010, Dev 11 Beta, and the _NT_SOURCE_PATH enviroment variable used
- by WinDBG.
- NAME
- Get-SourceServerFiles
- SYNOPSIS
- Prepopulate your symbol cache with all your Source Server extracted source
- code.
- SYNTAX
- Get-SourceServerFiles [-CacheDirectory] <String> [[-SrcTool] <String>] [<CommonParameters>]
- DESCRIPTION
- Recurses the specified symbol cache directory for PDB files with Source Server
- sections and extracts the source code. This script is a simple wrapper around
- SRCTOOl.EXE from the Debugging Tools for Windows (AKA WinDBG). If WinDBG is in
- the PATH this script will find SRCTOOL.EXE. If WinDBG is not in your path, use
- the SrcTool parameter to specify the complete path to the tool.
- PARAMETERS
- -CacheDirectory <String>
- The required cache directory for the local machine.
- -SrcTool <String>
- The optional parameter to specify where SRCTOOL.EXE resides.
- NAME
- Get-SymbolServer
- SYNOPSIS
- Returns a hashtable of the current symbol server settings.
- SYNTAX
- Get-SymbolServer [<CommonParameters>]
- DESCRIPTION
- Returns a hashtable with the current source server directories settings
- for VS 2010, Dev 11 Beta, and the _NT_SYMBOL_PATH enviroment variable.
- NAME
- Get-SysinternalsSuite
- SYNOPSIS
- Gets all the wonderful Sysinternals tools
- SYNTAX
- Get-SysinternalsSuite [-Extract] <String> [[-Save] <String>] [<CommonParameters>]
- DESCRIPTION
- Downloads and extracts the Sysinternal tools to the directory you specify.
- PARAMETERS
- -Extract <String>
- The directory where you want to extract the Sysinternal tools.
- -Save <String>
- The default is to download the SysinternalsSuite.zip file and remove it after
- extracting the contents. If you want to keep the file, specify the save
- directory with this parameter.
- NAME
- Get-Uptime
- SYNOPSIS
- Returns how long a computer has been running.
- SYNTAX
- Get-Uptime [[-computerName] <String>] [<CommonParameters>]
- DESCRIPTION
- Returns the TimeSpan for how long a computer is running. If you’d like it
- formatted you can use “Get-Uptime -f {0}”
- PARAMETERS
- -computerName <String>
- NAME
- Set-SourceServer
- SYNOPSIS
- Sets the source server directory.
- SYNTAX
- Set-SourceServer [-Directory] <String> [<CommonParameters>]
- DESCRIPTION
- Sets the source server cache directory for VS 2010, Dev 11 Beta, and WinDBG
- through the _NT_SOURCE_PATH environment variable to all reference the same
- location. This ensures you only download the file once no matter which
- debugger you use. Because this cmdlet sets an environment variable you
- need to log off to ensure it’s properly set.
- PARAMETERS
- -Directory <String>
- The directory to use. If the directory does not exist, it will be created.
- NAME
- Set-SymbolServer
- SYNOPSIS
- Sets up a computer to use a symbol server.
- SYNTAX
- Set-SymbolServer [-Internal] [-Public] [[-CacheDirectory] <String>] [[-SymbolServers] <String[]>] [-WhatIf] [-Confi
- rm] [<CommonParameters>]
- DESCRIPTION
- Sets up both the _NT_SYMBOL_PATH environment variable as well as Visual Studio
- 2010 and Dev 11 Beta (if installed) to use a common symbol cache directory as
- well as common symbol servers.
- PARAMETERS
- -Internal [<SwitchParameter>]
- Sets the symbol server to use to http://SymWeb. Visual Studio will not use
- the public symbol servers. This will turn off the .NET Framework Source
- Stepping. This switch is intended for internal Microsoft use only.
- You must specify either -Internal or -Public to the script.
- -Public [<SwitchParameter>]
- Sets the symbol server to use as the two public symbol servers from Microsoft.
- All the appropriate settings are configured to properly have .NET Reference
- Source stepping working.
- -CacheDirectory <String>
- Defaults to C:SYMBOLSPUBLICMicrosoftPublicSymbols for -Public and
- C:SYMBOLSINTERNAL for -Internal.
- -SymbolServers <String[]>
- A string array of additional symbol servers to use. If -Internal is set, these
- additional symbol servers will appear after HTTP://SYMWEB. If -Public is
- set, these symbol servers will appear after the public symbol servers so both
- the environment variable and Visual Studio have the same search order.