My latest Prof. PowerShell column has a function that takes a computername as pipelined input. It then returns a custom object showing free space on drive C:\. The point of the column was to demonstrate how to make a function…
Read More
Recently in the VBScript forum at ScriptingAnswers.com there was a question about creating a file name from the current date, but with leading zeros. This is a pretty common question. It is easy enough to get the month or day…
Read More
If you use Twitter and like to script, especially in PowerShell, then I think you’ll like this. A new site, TweeterTags.com has launched that allows you to tag your Twitter profile. The upshot is that this makes it easier to…
Read More
I love aliases in PowerShell because they make working in the interactive shell so much easier and faster. I’ve even created aliases for common apps I use like PrimalScript and PrimalForms so I can launch them from PowerShell with a…
Read More
I needed a demonstration for one of my last online PowerShell classes on using COM objects in PowerShell. I took an old VBScript that used Microsoft Word to get document statistics such as word and page count and transformed it…
Read More
The other day I gave you a function to create a VBScript style message box in PowerShell. If you find yourself needing MsgBox in PowerShell, you’re likely going to want InputBox. This too is accomplished using the [microsoft.visualbasic.interaction] class. You’ll…
Read More
If you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in…
Read More
The other day I posted a VBS function for getting drive utilization. It seems only fair to give PowerShell a chance to play.
1: Function Get-Utilization {
2: Param([string]$computername=$env:computername,
3: [string]$ID="C:"
4: )
5:
6: #suppress errors messages
7: $errorActionPreference="silentlycontinue"…
Read More
Here’s another recent topic from the ScriptingAnswers.com forums which I thought I’d share. The forum members wanted to delete files if the drive utilization exceeded a certain threshold. Using Windows Management Instrumentation (WMI) with VBScript I came up with something…
Read More
In my script and function development, I often add the line $DebugPreference="SilentlyContinue" to the beginning of my code. Throughout the script I add lines using Write-Debug that tell me what the script is doing or the value of a particular…
Read More