Includes a lot of bugfixes (including a nasty one with the new PowerGUI) and speed improvements.
The update comes as always via the auto-update function in SnippetManager, so if you turned that off, turn it back on! :) (at least for a second)
You can of course download the update on the SnippetManager page (link at the top of this page).
PowerShell opens up a lot of possibilities when it comes to task automation. And while it’s often been used to automate currently pendingtasks, it can also be used for continuously monitoring things in the background.
Whether you need to monitor the utilization of a file server at work or the temperature of your hard drives at home, the principle is always the same: the tool or script should work silently and invisible in the background, until there is something you need to know.
There are a few ways to achieve that with PowerShell, one is to use a NotifyIcon and a Timer.
The Notify Icon
With the NotifyIcon class you can display an icon in the system tray, which can be equipped with a tooltip text for on demand status information:
and a balloon tip to get your attention when necessary:
If you want to create a GUI for your Powershell script, you’ve got two options. You can either use Windows Forms (WinForms) or Windows Presentation Foundation (WPF).
I wont bother you with the technical differences (they are well explained here if you’re interested). The practical differences however, are that with Windows Forms you will use the native Windows interface elements and you will have only limited control on how things will look like. With WPF you got the full freedom of design, but the downside is that it’s way more complicated to use than WinForms, especially for beginners. And for WinForms, there are WYSIWYG-Editors available, which generate native Powershell code. That’s a huge advantage, because you simply click your GUI-elements together and immediately get your ready-to-use Powershell code.
You usually won’t have the time to create a fancy design anyway and if you really want to, you can do a few nice things with WinForms too. But for the purpose of creating a GUI for your administrative script or a nice and convenient little tool for your users, WinForms will do just fine:
(… and you should think about adding one to your next Powershell script.)
The Console Window
I know quite a few admins who don’t like GUIs, for some reason or another. Linux admins especially, they are the high priests of the console cult. I’m quite sure some of them really believe GUIs are evil somehow and not meant to be. I guess it has something to do with the fact that for quite some time GUI was a synonym for MS Windows. And they really hate that. :) Continue reading “Why GUIs are good…”→