We truly appreciate all the comments and feedback you’ve been giving us on our blog entries. We’ve tried to respond to comments in a timely manner. You are still welcome to leave comments. However, if you have a question that requires an answer or a problem trying something we’ve blogged about, we’re hoping you’ll post something in the forums at ScriptingAnswers.com.
Category: Windows PowerShell
Schedule Hidden PowerShell Tasks
I’ve had some questions lately about scheduling a PowerShell script. This is something we’ve covered a little bit. In this entry I discuss how to wrap your PowerShell script in a VBScript and schedule it so that it runs completely hidden.
Drive it Home
An exciting feature of PowerShell is that you can present things like the registry as a drive. This is accomplished with the PSDriveInfo object. If you run Get-PSDrive in PowerShell you will see all the “drives” that you can connect to. You can also create additional drives with New-PSDrive.
Make an Old Friend Do Your Work
I’ve been revisiting an old friend from the days of DOS and ancient versions of Windows. I had forgotten how much work this friend did for me. The more I thought about it, and the more I caught up with this friend, the more I realized there is a entirely new generation of system administrators that have never met him.
Make-A-Cmdlet: Part 1, Workshop Introduction
Coming soon: I’ll be publishing a series of blog articles on building a simple cmdlet for Windows PowerShell. The bade news is that you’ll need to use Visual Studio 2005 and Visual Basic .NET to follow along – the good news is that it isn’t going to be nearly as hard as that sounds!
If you’re interested, you’ve got a …
More Fun with File Aging
A few days ago, I posted an entry on how to run a file aging report using PowerShell. The script as written was pretty and all, but a little limiting. You really can’t do anything with the results. In many regards it is a VBScript rewritten for PowerShell (not that there’s anything wrong with that). But PowerShell can do so much more, especially when you think about piping objects between cmdlets. The original script just produces string output so you can’t do much else with it. What the script needs is a way to produce an object that can then be used by other PowerShell cmdlets.
File Aging With PowerShell
A very common solution that screams for an automated solution is to get a file aging report: Given a specific folder, how many files are there and how old are they? Here is one possible solution that uses PowerShell. It doesn’t require WMI or the VBScript FileSystemObject, only native PowerShell. The script only requires that you specify a folder name or path to check. This can be a local folder or a UNC. When finished you get a simple, but colorized, report.
Power your Shell with PowerGadgets
By now you’ve installed PowerShell, tried out a few cmdlets and are trying to figure out how you will use all this great information. Well, there’s more for you to take a look at. Even though PowerShell is a console, you sure to still want some GUI elements such as charts and gauges. Fortunately, that’s pretty easy to accomplish.
Start Simple
Here’s another quick suggestion, especially for VBScript, that will make script development and debugging a little easier and a lot less stressful. It may seem like common sense, but sometimes we all just need a reminder: Start Simple.
More Pinging…
Okay, I teased yesterday… so check out this function:
Function Ping-Name {
PROCESS {
$wmi = get-wmiobject -query “SELECT * FROM Win32_PingStatus WHERE Address = ‘$_'”
if ($wmi.StatusCode -eq 0) {
$_
}
}
}Notice that the function name looks like a cmdlet name? This function can sorta be used l ike a cmdlet. For example:
Get-Content …