ps1

Updating PowerShell Modules

In a previous tip, you learned about the new modules in PowerShell v.2, which can be loaded using Import-Module. Once you have loaded a module, it...

read more

Creating Script Modules

In PowerShell v.2, there is a new feature called "module," which is a file with the extension .psm1 and behaves almost exactly like a...

read more

Trap and Try/Catch

Trap, which has been around since PowerShell v.1, is designed to catch errors and works like this: trap { Write-Host -foregroundcolor Yellow `...

read more

Is PowerShell Available?

As PowerShell becomes more important, you may want to automatically check whether it is available on a machine. To determine whether any PowerShell...

read more

Finding Script Errors

There is scripting expertise built-in to PowerShell v.2 that can be activated like this: set-strictmode -version 1set-strictmode -version 2 Use the...

read more

Getting System Uptime

If you'd like to determine a system's uptime, you should use WMI and convert the WMI date into a more readable format: function...

read more

Adding Custom Properties

You may have heard that PowerShell can add custom properties to objects. While we are not going into much detail about this here, we'd like to...

read more