Scripting Blog [archived]

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

Latest posts

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

PowerTip: Restore PowerShell ISE to Default Settings

Doctor Scripto

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()

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

Weekend Scripter: Customize PowerShell Title and Prompt

Doctor Scripto

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

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

PowerTip: Set Personal Environment Variable from PowerShell

Doctor Scripto

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.

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

Learn Easier Way to Build Command for PowerShell.exe

Doctor Scripto

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

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

PowerTip: Save Help Content for Module

Doctor Scripto

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\

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

‘Tis the Season…for Giving Back

Doctor Scripto

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

Dec 31, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Here-Strings with PowerShell

Doctor Scripto

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! "@...

Dec 31, 2015
Post comments count 0
Post likes count 0

Sounds of the Holidays–Part 2

Doctor Scripto

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

Dec 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Launch Minimized Application with PowerShell

Doctor Scripto

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.