Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Test-ModuleManifest 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. A module creator could use Test-Module to ensure that files listed in a *.psd1 file, possibly created by New-ModuleManifest , are valid.
Example:
Test that the C:\Users\User1\Documents\WindowsPowerShell\Modules\Logfile-Module\Logfile-Module.psd1 (created in the New-ModuleManifest example) is valid.
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-ModuleManifest 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. Creators of Modules can use the New-ModuleManifest cmdlet to create a module manifest *.psd1 file which can be used to enhance to processes around a module, such as any prerequisites.
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.
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!
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.
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.
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.
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.
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.
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.