The “Hey, Scripting Guys!” blog has been retired. There are many useful posts in this blog, so we keep the blog here for historical reference. However, some information might be very outdated and many of the links might not work anymore.
New PowerShell content is being posted to the PowerShell Community blog where members of the community can create posts by submitting content in the GitHub repository.
Scripting Blog [archived]
Formerly known as the "Hey, Scripting Guy!" blog
Latest posts
PowerShell spotlight: February 2016
Summary: Windows PowerShell MVP, Teresa Wilson, shares her roundup of Windows PowerShell activities for the coming months. Hello scripters, Teresa Wilson here. I hope you had a marvelous weekend and are ready to tackle this week. Ed is finally getting back to normal and we have a few trips coming up—all Windows PowerShell related. Arizona PowerShell User Group March 1 in Phoenix First of all, we will be in Phoenix, AZ on March 1, 2016 for the Arizona PowerShell User Group (AZPOSH) meeting. I also heard from a little birdie that my good friend Jason Helmick will be there. The signup is not available yet (they are ...
PowerTip: Use PowerShell to view properties and their values for a .NET Framework class
Summary: Learn how to view properties and the associated values of those properties of .NET Framework classes with Windows PowerShell. How can I use Windows PowerShell to view the properties and their values from a .NET Framework class, such as System.String? Use the Type accelerator [string], pipe the output to the Format-List cmdlet, and use an asterisk to select all properties: [string] | fl * Note: fl is an alias for Format-List.
PowerTip: Find properties of .NET Framework class with PowerShell
Summary: Learn how to use Windows PowerShell to display properties of a .NET Framework class. How can I use Windows PowerShell to easily display properties of a .NET Framework class? Pipe the type accelerator to the Get-Member cmdlet and specify the MemberType property, for example: [string] | gm -MemberType Properties Note: gm is an alias for Get-Member.
PowerTip: Find information about .NET Framework method with PowerShell
Summary: Learn how to use Windows PowerShell to find information about a .NET framework method. How can I use Windows PowerShell to find basic information about a particular .NET Framework method? Use the GetMethod method from the class, for example: [math].GetMethod("Tan") Note The method name is case sensitive and it must be in double quotation marks.
PowerTip: Use PowerShell to find all methods from .NET Framework class
Summary: Learn how to find all methods from a .NET Framework class by using Windows PowerShell. How can I use Windows PowerShell to show both static and dynamic methods for a .NET Framework class? Use the GetMethods method from the class. This example uses the System.Math class to return the method name and if the method is static: [math].GetMethods() | Select Name, IsStatic -Unique
PowerTip: Return remainder after dividing two numbers
Summary: Use Windows PowerShell to return the remainder after dividing two numbers. How can use Windows PowerShell to divide two numbers and only return the remainder (called a modulo operation)? In Windows PowerShell, the modulo operator is the % sign. Here are a few examples of how to use it: PS C:\> 3 % 2 1 PS C:\> 5 % 2 1 PS C:\> 11 % 2 1
How to contribute to PowerShell documentation
Summary: Learn how to contribute to Windows PowerShell documentation via various community initiatives. Today’s guest blog post is by Microsoft premier field engineer, Ashley McGlone. He will be speaking at PowerShell Saturday, so come join us for a great day of PowerShell learning. For more information, see PowerShell Saturday in Tampa, FL, March 19, 2016. Follow Ashley through his TechNet blog, Goatee PFE, and Twitter. Here’s Ashley… How many times have you found PowerShell documentation that was not up-to-date? Or maybe you could not even find the documentation you needed. Today I’ll be discussing ways that ...
PowerTip: Add number to existing variable value
Summary: Learn how to easily add a number to an existing value stored in a variable and update the value of the variable. How can I use Windows PowerShell to add a number to a value stored in a variable so that I can update the value in that variable with the number and store the number back into the variable? Use the += operator. This example adds 3 to the value stored in the $a variable and then stores the new value back into the variable: PS C:\> $a = 5 PS C:\> $a += 3 PS C:\> $a 8
Use PowerShell to parse event log for shutdown events
Summary: Using the Windows PowerShell Get-EventLog cmdlet makes it easy to parse the system event log for shutdown events. One of the great things about central Florida during this time of the year is that there are certain fruits, such as red grapefruit, that are in season. This is also true of a certain variety of tangelo that is super sweet. However, as sweet as both of these are, neither is a sweet as parsing the event log with Windows PowerShell. It makes it easy to gain insights into what is going on with your computer, server, or whatever device. Using Get-EventLog cmdlet is super easy There are two basic ...