powershell

PowerShell 2.0: One Cmdlet at a Time 71 New-Module

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-Module cmdlet. What can I do with it? PowerShell 2.0 introduces the concept of modules; essentially they are the evolution of snapins from PowerShell 1.0. New-Module enables you to create a dynamic module from a script block that is available in the current session. Note: New-Module does not create a module on disk available for use at a later date!

PowerShell 2.0: One Cmdlet at a Time 70 Import-Module

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Import-Module cmdlet. What can I do with it? PowerShell 2.0 introduces the concept of modules; essentially they are the evolution of snapins from PowerShell 1.0. Import-Module enables you to add one or more modules to your current session. Examples: Import the PSDiagnostics module and examine the newly available commands in the session from that module by using Get-Module.

Reporting on VMware Update Manager Baselines with PowerCLI

I’ve mentioned on this blog before that I’ve been using VMware Update Manager a lot recently - and wrote about some of my experiences here. Today I was really pleased to see that Carter Shanklin’s team released some cmdlets for PowerCLI to cover Update Manager which had only previously been available back as a beta in the VI Toolkit days. They arrived just in time because I am currently preparing for a round of ESX patching and I needed to provide a report of hotfixes I was intending to deploy for a particular version of ESX.

PowerShell 2.0: One Cmdlet at a Time 69 Get-WinEvent

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-WinEvent cmdlet. What can I do with it? Retrieve items from Event Logs including event logs generated by the Windows Event Log technology, new since Windows Vista / 2008 Server, in addition to the classic System, Security and Application Logs. Note: it requires .NET Framework 3.5 or later installed. Examples: Retrieve events from the Setup Event Log.

PowerShell 2.0: One Cmdlet at a Time 67 Remove-EventLog

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-EventLog cmdlet. What can I do with it? Remove an Event Log. Example: Remove the Event Log named App1 on the remote computer Test01. Confirm it has been removed with Get-EventLog. Remove-EventLog -LogName App1 -ComputerName Test01 Get-EventLog -List -ComputerName Test01 Confirmation that the App1 Event Log has been removed. Note: To perform this task remotely you will need to ensure that Remote Event Log Management has been added as an Exception in Windows Firewall.

PowerShell 2.0: One Cmdlet at a Time 68 Show-EventLog

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Show-EventLog cmdlet. What can I do with it? Open Event Viewer on a local or remote computer. Example: Open Event Viewer on the remote computer Test01. Show-EventLog -ComputerName Test01 You will see that Event Viewer on the remote computer Test01 opens on the local machine. How could I have done this in PowerShell 1.

PowerShell 2.0: One Cmdlet at a Time 66 Limit-EventLog

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Limit-EventLog cmdlet. What can I do with it? Set the size and age properties of an Event Log. Example: Set the following properties on the Application Log on the remote computer Test01: Maximum Size = 5MB OverflowAction = DoNotOverWrite Limit-EventLog -ComputerName Test01 -LogName Application -MaximumSize 5MB -OverflowAction DoNotOverWrite Before: After: How could I have done this in PowerShell 1.

PowerShell 2.0: One Cmdlet at a Time 65 New-EventLog

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-EventLog cmdlet. What can I do with it? Create a custom Event Log. Example: Create a custom Event Log named App1 with an event source of AppEvent. Use the Get-EventLog cmdlet to confirm it has been created. Tip: New-EventLog requires a PowerShell session with elevated privileges. New-EventLog -LogName App1 -Source AppEvent Get-EventLog -List

Updated Exchange 2003 PowerGUI PowerPack

Since PowerGUI version 1.8 there have been some great enhancements in PowerPack management. So I finally got round to updating the Exchange 2003 PowerPack and publishing it in the new format. One of the best new features is the ability to update the PowerPack from the application - previously you had to manually download the new version, remove the old one then import the updated copy. Within the PowerPack Management Dialogue Box you can see the current version of your PowerPack:

PowerShell 2.0: One Cmdlet at a Time 63 Remove-PSBreakpoint

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-PSBreakpoint cmdlet. What can I do with it? Remove debugging breakpoints that have been set with Set-PSBreakpoint. Examples: Check existing breakpoints and remove the breakpoint with ID 0. Get-PSBreakpoint Remove-PSBreakpoint -Id 0 Confirmation that breakpoint with ID 0 has been removed. Check existing breakpoints and remove all of them. Get-PSBreakpoint Get-PSBreakpoint | Remove-PSBreakpoint