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
PowerTip: Restore PowerShell ISE to Default Settings
Summary: Learn how to restore the Windows PowerShell ISE to its default configurations. How can I restore the Windows PowerShell ISE to its default configurations? Use the four built-in RestoreDefault methods with the PSise object to bring back everything in the ISE to the original settings: $PSise.Options.RestoreDefaults()$PSise.Options.RestoreDefaultConsoleTokenColors()$PSise.Options.RestoreDefaultTokenColors()$PSise.Options.RestoreDefaultXMLTokenColors()
Weekend Scripter: Customize PowerShell Title and Prompt
Summary: Learn how to interactively update the Windows PowerShell prompt and title. Honorary Scripting Guy, Sean Kearney, is here today to have a little bit of fun with the Windows PowerShell console. Why not? It’s a Sunday, it’s the last day of my time off, and I feel like playing. There have been many posts online about the fun you can have with the $Host.UI.RawUI object in Windows PowerShell. You can use it to edit cursor locations, flip colors about…almost anything your little heart desires. Another fun little thing we’re going to play with is the Windows PowerShell prompt. Yes! You&r...
PowerTip: Set Personal Environment Variable from PowerShell
Summary: Access the $ENV object in Windows PowerShell to alter personal environment settings. How can I use Windows PowerShell to change a system environment variable such as the user %TEMP%? You can read any personal environment settings by using $ENV:VariableName, then assigning a value. For example, to change your personal %TEMP% to a new location, use: $ENV:Temp=C:\Foo Note This presumes C:\Foo exists and will alter the variable for the present PowerShell session.
Learn Easier Way to Build Command for PowerShell.exe
Summary: Learn how to parse a here-string with Windows PowerShell.Honorary Scripting Guy, Sean Kearney, is here to show you a neat little trick.Anyone who has ever scheduled a PowerShell task knows that if you want to launch a cmdlet directly in PowerShell, you would launch it like this:PowerShell.exe –ExecutionPolicy Bypass –command ‘Get-ChildItem’No challenge there. It also does not end there. You can add some down-right complex stuff in there, for example:PowerShell.exe –executionpolicy Bypass –command ‘Set-ExecutionPolicy Bypass;Import-Module DeployImage; New-WindowsP...
PowerTip: Save Help Content for Module
Summary: Learn how to target content to save with the Save-Help cmdlet. How can I use Windows PowerShell to save the Help content for a single module? Use the –module parameter with the Save-Help cmdlet, for example: Save-Help –module Dism –destination C:\Foo\
‘Tis the Season…for Giving Back
Summary: Guest blogger, Don Jones, discusses how you can share with the worldwide community.Today, special guest blogger, Don Jones offers ideas about how we all can increase the power of the PowerShell community…How’s your 2015 been? Hopefully, you’ve been taking advantage of some of the wonderful, free resources that are available in the global PowerShell community. Hopefully you’ve learned a new thing or two, solved a problem or two, and hoisted yourself up another rung of the PowerShell ladder.And hey…maybe in 2016, it’s time to give back a little. Oh, I know, it’s ...
PowerTip: Use Here-Strings with PowerShell
Summary: Learn the basic use of a here-string in Windows PowerShell. What is a here-string and how do I use it? In PowerShell, you can use here-strings to declare blocks of text. They’re declared just like regular strings except they have an @ on each end. Instead of being limited to one line, you can declare an entire block or a multiple line string. Here-strings are also useful for making a string composed of the text to execute a command. Try these examples: $String1 = @" Get-ChildItem c:\temp "@ $String2 = @" This is somemultiple line text! "@...
Sounds of the Holidays–Part 2
Summary: MVP, Thomas Rayner, continues to inspire holiday spirit by using PowerShell to trigger multimedia. Yesterday in Sounds of the Holidays–Part 1, I tried to inspire my coworker, Matthew, with some cool holiday messages. Unfortunately, Matthew is still being a Grinch and I need to step up my game. Instead of some spoken messages from “Ebenezer Script,” I’m going to play him some holiday music every time he signs in to his workstation. I’m a fan of the Charlie Brown holiday jazz album by the Vince Guaraldi Trio, and they’ve been kind enough to upload some of their music to YouTube. I’ve chosen this great pi...
PowerTip: Launch Minimized Application with PowerShell
Summary: Learn how to specify the launch state of an application through Windows PowerShell. How can I launch a minimized application in Windows PowerShell instead of opening the window in the foreground? Use the –WindowStyle parameter with the Start-Process cmdlet, and select Minimized, for example: Start-Process -WindowStyle Minimized 'iexplore.exe' Note You can also choose Hidden, Maximized, or Normal, but not all applications support all modes.