If you use the PowerShell ISE as your primary script editor, you might want to tweak it a bit. The first thing you’ll need is your ISE profile script. If it doesn’t exist, you’ll need to create. PowerShell will look for file C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1 (on Windows 7 anyway). Any commands you put in this file will…
Get Variable Definition
Last week a question came across my email about how to find out where a variable came from. I thought this was a great question because I’ve run into this scenario as well. I see a variable but don’t recall what command I typed to create it. What I need is an easy way to…
PowerShell Automatic Logging
If you regularly download or look at the functions and scripts I post here, you’ll notice I often use Write-Verbose to indicate what is happening. This comes in handy for troubleshooting. But often it would also be helpful to record as a log file of script activity. Unfortunately, you can’t pipe Write-Verbose to Out-File. So…
Get My Variables
As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I’d simply use Get-Variable. What I really want is a way…
PowerShell Deep Dive Formatting and Extensions
I just found out I will be presenting at the PowerShell Deep Dive April 18-19 that is part of TEC 2011. This promises to be THE PowerShell event everyone has been waiting for. I’ll be presenting on format and type extensions. Mastering Format and Type Extensions Windows PowerShell is designed with administrators in mind. The…
Join Me in Atlanta for TechEd 2011
I’m very excited to be presenting at Microsoft TechEd North America 2011, this year in Atlanta, GA. I’ll be presenting two breakout sessions and will likely be there most of the week so there will be plenty of time to connect with people. I have what I hope are some very interesting sessions.
PowerShell ISE Most Recent Files
The PowerShell ISE is a handy tool for editing and testing your scripts, functions and modules. If you can’t afford a good commercial editor then you should at least be using the ISE. One benefit of the ISE is that it has its own object model which means it is extensible. One thing I always…
Create New Computer with ADSI
UPDATE 12 Sept. 2022: In attempting to correct obsolete information( this was originally published in 2011), I removed the contents of this post. But I did manage to save the function, which is all you probably care about anyway.
Set File Encoding
For most people, when you create a script in PowerShell you generally don’t worry too much about how it is encoded. Most everything you encounter in PowerShell uses Unicode files. But when sharing files sometimes this causes problems. For example, when I post a script for download here, I need to make sure it is…
Friday Fun – Snappy Shortcuts
In one of my recent Prof. PowerShell columns, I wrote about using the Wscript.Shell VBScript object in PowerShell to retrieve special folder paths. Another handy trick is the ability to create shortcut links to either file or web resources. Let me show you how to accomplish this in PowerShell and why you might want to.
Friday Fun – More PowerShell Bingo
For last week’s Friday Fun, I posted a PowerShell script to create a traditional Bingo card. I hoped you would also learn a few PowerShell concepts along the way. This week I’ve taken this to the next level, and have a complete module that not only creates the card but also let’s you play the…
PowerShell Regular Expressions by the Numbers
I’ve been working on something the last week that brought me back into sometimes frightening world of regular expressions. But as the saying goes, we only fear what we don’t understand. So a little knowledge can be a wonderful thing. In this particular situation I was looking for a regular expression to determine if a…
Friday Fun: Let’s Play Bingo!
Today Campers we’re playing Bingo. Or at least getting ready to. This week I have some PowerShell code that will create a BINGO card. For those of you outside of North America you might need to take a crash course on this game. But even if you don’t play, this article will demonstrate some useful…
Importing and Exporting Registry Items
A while ago I posted a function to export registry items to either a CSV or XML file. Recently I had a question on Twitter about importing, which I assumed meant from my exported file. The import is actually pretty easy as I’ll show you, although it did require a change to the original Export-Registry…