Scripting Blog [archived]

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

Latest posts

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

PowerShell spotlight: February 2016

Doctor Scripto

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 ...

Jan 31, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to view properties and their values for a .NET Framework class

Doctor Scripto

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.

Jan 31, 2016
Post comments count 0
Post likes count 0

PowerTip: Find properties of .NET Framework class with PowerShell

Doctor Scripto

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.

Jan 30, 2016
Post comments count 0
Post likes count 0

PowerTip: Find information about .NET Framework method with PowerShell

Doctor Scripto

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.

Jan 30, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to find all methods from .NET Framework class

Doctor Scripto

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

Jan 29, 2016
Post comments count 0
Post likes count 0

PowerTip: Return remainder after dividing two numbers

Doctor Scripto

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

Jan 29, 2016
Post comments count 0
Post likes count 0

How to contribute to PowerShell documentation

Doctor Scripto

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 ...

Jan 28, 2016
Post comments count 0
Post likes count 0

PowerTip: Add number to existing variable value

Doctor Scripto

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

Jan 28, 2016
Post comments count 0
Post likes count 0

Use PowerShell to parse event log for shutdown events

Doctor Scripto

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 ...