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.
Tag: functions
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…
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…
Friday Fun Out-Rainbow
For my readers who are just discovering my Friday posts, let me remind you that these are not necessarily practical, production worthy PowerShell scripts and functions. They are meant to be fun, yet educational. For example, in today’s Friday Fun I have a function that takes string input and writes colored output to the console….
We Pause a Moment
Most of the time when running a PowerShell script or series of commands you want to blast your way through. But there might be times where you want to pause script execution. Perhaps to display an informational message or to simply pace execution. In my work as a trainer and speaker I often use the…
Convert to Title Case
After a long holiday break, some travel and a few training classes its time to get back in the swing of things. Today I have a relatively simple function, that if nothing else demonstrates how to use object methods. The challenge is to take a string of text and convert it into title case; so…
Out-CompressedFile
I’m not sure where this idea came from, but I thought it might be nice to redirect output to a compressed text file. I know disk space is cheap these days but perhaps you’re running PowerShell 2.0 on an older platform and you want to save output from a command that will generate a ton…
Friday Fun – The Kitchen Sink Prompt
On my last Friday Fun post on PowerShell prompts, I got a terrific comment from Bart Vandyck about his prompt which has just about everything you would want. I too have a “kitchen sink” prompt, that is to say, one with the proverbial “everything but the kitchen sink”. Or you might consider this an extreme…
Friday Fun Playing with Strings
While I was busy working, it turned into Friday which means time for a little PowerShell fun. I can’t say you’ll find any deep, meaningful, production use from today’s post, but you might pick up a few techniques, which is really the point. Today we’re going to have some fun with strings and arrays.
PowerShell ISE New Function
Yesterday I showed how to add a menu choice to the PowerShell ISE to insert the current date and time. Today I have something even better. At least it’s something I’ve needed for awhile. I write a lot of advanced functions in PowerShell. I’m often cutting and pasting from previous scripts and generally not being…
PowerCLI VM Peek
Now that I believe I’ve resolved my hardware issues with my VMware server, I’m expecting to use it much more. I’m also continuing my exploration of the PowerCLI tool set which allows me to manage my virtual infrastructure from a Windows PowerShell session. One task that I frequently need is to identify which virtual machines…
Get Your TCP Ports Here!
Once again, the PowerShell forum at ScriptingAnswers.com has undone me. I was answering a question about running Netstat in a PowerShell session on a remote computer which got me thinking about a PowerShell function to turn NETSTAT.EXE output into objects. Once you have an object then you can do all sorts of things. Needless to…
PowerShell Weather Module
I first wrote a Windows PowerShell function several years ago to retrieve weather information via Yahoo’s weather service. I’ve been itching to rewrite it and finally found some time over the weekend. Turns out it’s a good thing I did because the method I had been using to query the Yahoo web service has been…
Get Parameter
As I continue to work on the 2nd edition of Managing Active Directory with Windows PowerShell: TFM, I find situations where I need a tool to get information out of Windows PowerShell. For example, the cmdlets in the Microsoft Active Directory module have a lot of parameters and I wanted to know some specifics. Now…