PowerShell 2.0: One Cmdlet at a Time 72 Export-ModuleMember

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Export-ModuleMember 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. Export-ModuleMember specifies elements from a module, like functions or variables, which can be exported. Note: This cmdlet can only be used within a *.psm1 script module file or a dynamic module created with New-Module.

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.

Bug in Cluster mem.usage.average Statistic in vSphere 4.0 U1

A while back I posted a script on a basic capacity report I run each month to get an overview of CPU and Memory usage in our various clusters. Since upgrading to vSphere 4.0 U1 I noticed some strange behavior in the results for memory, i.e. they came back at pretty close to 0% (typically between 0.05 and 0.06%) for the average memory usage in a cluster which typically were quite heavily used.

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