Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Latest posts

Feb 13, 2017
Post comments count 1
Post likes count 2

Debugging PowerShell script in Visual Studio Code – Part 2

Doctor Scripto

Welcome to Part 2 of the series about how to debug PowerShell in Visual Studio Code. In Part 1, we looked at the debugging features of Visual Studio Code with the PowerShell extension installed.  Now we will examine the various ways that you can start to debug PowerShell script with Visual Studio Code. Single file debugging With the 1.9 release of Visual Studio Code, you can now debug a PowerShell script with no debugger configuration required and no need to open a workspace. That is, you can open a single PowerShell file instead of a folder and still debug it. In the following example, I open a single script fi...

Feb 9, 2017
Post comments count 0
Post likes count 0

Cloud operating system deployment: WinPE in Azure

Doctor Scripto

Jason Ryberg is a Consultant for Microsoft, where he writes PowerShell code and provides DevOps support.  Have you ever wanted to boot to WinPE in Azure and select an Microsoft Deployment Toolkit (MDT) Task Sequence?  As part of an informal cloud-readiness evaluation, I was asked to deploy a server image to Azure. The image that I was given would run the MDT Deployment Wizard to allow for the selection of deployment options. But, how could I choose deployment options if I could not reach the Azure virtual machine in the boot environment? Read on to find out how to interact with an Azure virtual machine in a prebo...

Feb 7, 2017
Post comments count 0
Post likes count 0

Announcing the 2016 Honorary Scripting Guys

Doctor Scripto

Summary: The Honorary Scripting Guys for 2016 are announced. Microsoft Scripting Guy, Ed Wilson, is here. Well, it has been an awesome year for Windows PowerShell and for the community. The Scripting Wife and I had the opportunity to speak at lots of user groups and conferences last year. This involved many, many miles of travel. Luckily, the community pitched in and helped – a lot – with the Scripting Guys blog … and so, once again, it was the top Microsoft blog. The cool thing about a strong community – and of community contributions to the blog is that we can get lots of different views about how we can use W...

Feb 6, 2017
Post comments count 6
Post likes count 3

Debugging PowerShell script in Visual Studio Code – Part 1

Doctor Scripto

Summary: Here's a look at the many features of the PowerShell debugger for Visual Studio Code. In previous blog posts, we covered how to get started with PowerShell development in Visual Studio Code and the editing features of Visual Studio Code and the PowerShell extension.  If you don’t already have Visual Studio Code configured with the PowerShell extension, read those blog posts to get caught up. In the first of this two-part series, we will cover the many features of the PowerShell debugger for Visual Studio Code.  These features are provided by the PowerShell extension, or, more accurately, by the PowerSh...

Feb 3, 2017
Post comments count 0
Post likes count 0

PowerTip: Get a list of security patches installed in the last 90 days

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to get a list of all the security patches installed in the last three months. How can I list all the security patches that I’ve installed in the last 90 days? There’s a class for that! Just use , and you can retrieve this information. Here is an example:

Feb 3, 2017
Post comments count 3
Post likes count 1

PSScriptAnalyzer deep dive – Part 4 of 4

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows how to write a custom PSScriptAnalyzer rule. Hello! I’m Thomas Rayner, a Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a four-part series about how to use PSScriptAnalyzer. Part 1 – Getting started with PSScriptAnalyzer Part 2 – Suppressing, including, excluding rules Part 3 - Wrapping PSScriptAnalyzer with Pester to get formatted results Part 4 – Writing custom rules This ...

Feb 2, 2017
Post comments count 0
Post likes count 0

PowerTip: Get a list of suspended Azure Automation jobs

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how get a list of all your suspended Azure Automation jobs. I think I have an Azure Automation job that is getting suspended for running too long. How can I verify this? You can use the cmdlet and its flag to get this information. Here is an example: You can also use other values like , , and in that place.

Feb 2, 2017
Post comments count 0
Post likes count 1

PSScriptAnalyzer deep dive – Part 3 of 4

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows how to use Pester to get nUnit formatted results out of PSScriptAnalyzer. Hello! I’m Thomas Rayner, a Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a four-part series about how to use PSScriptAnalyzer. Part 1 – Getting started with PSScriptAnalyzer Part 2 – Suppressing, including, excluding rules Part 3 - Wrapping PSScriptAnalyzer with Pester to get formatted results Part 4 ...

Feb 1, 2017
Post comments count 0
Post likes count 0

PowerTip: Convert from UTC to my local time zone

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how write a function to convert from UTC to your local time zone. I have a time that I’d like to convert from UTC to my local time zone. How can I do this? You can write your own function to do this, and use the [System.TimeZoneInfo] .NET class and associated methods to make this conversion easily. Here is an example: { param( [parameter(Mandatory=$true)] [String] $UTCTime ) $strCurrentTimeZone = (Get-WmiObject win32_timezone).StandardName $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone) $LocalTime = [System.TimeZoneInf...