As promised, I have put together the most current versions of my slide decks and demos. A word of caution on the demos: many of them were designed to be used with my Start-Demo function, which essentially steps through the demo file one line at a time. The AD demos do include a few scripts…
Category: PowerShell
Convert Transcript to Script
During my PowerShell scripting best practices at Techmentor last week I mentioned a function I had to convert a PowerShell transcript to a script file. Since there’s very little difference between an interactive session and a script, parsing the transcript can yield 80% or more of a script very quickly. I wrote such a function…
Friday Fun ConvertTo Text File
When I’m working on simple PowerShell scripts, I find myself using the PowerShell ISE. When I need to share those scripts on my blog I inevitably need to save the script as a text file so I can post it. I finally realized that instead of the few manual steps, I could automate this process.
St. Patrick’s Bar Order
Let’s have a little fun with St. Patrick’s Day and perhaps even learn a little PowerShell.
Get Local Admins One-Liner
Working with local users and groups can get a little messy in PowerShell. But I wanted to share a quick one-liner you could use to list all the members of the Administrators group.
Friday Fun Virtual Demos
I’ve been prepping my demo scripts for Techmentor using the ubiquitous Start-Demo, and realized I could take things further. I mean, why do I have to do all the talking? Windows 7 has a terrific text to speech engine so why not take advantage of it. With a little work I could create a virtual…
Get IP Data
I was doodling in PowerShell this morning and ended up with what I hope is a useful function to retrieve IP configuration information, sort of like IPCONFIG, but using WMI. The beauty is that I can connect to remote machines and the output is an object which leads to all sorts of possibilities. My function…
A few ISE tweaks
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…
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…
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.