Powershell

Deleting Event Logs

Working with event logs has become a lot easier in PowerShell v.2, and you have seen how you create and maintain your own logs. So, if you'd...

read more

Creating Your Own Eventlog

In PowerShell v.2, it is very easy to create and maintain your very own event logs to track errors in your scripts or other automation solutions....

read more

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