powershell

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

PowerShell 2.0: One Cmdlet at a Time 64 Clear-History

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Clear-History cmdlet. What can I do with it? Remove commands from the history of those entered in the current session. PowerShell has two places where a history of the commands you have entered are kept. Within the console you can use F7 to view them and Alt-F7 to clear that list. There are also some cmdlets for managing PowerShell history, such as Get-History and the new Clear-History.

PowerShell 2.0: One Cmdlet at a Time 61 Disable-PSBreakpoint

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Disable-PSBreakpoint cmdlet. What can I do with it? Disable debugging breakpoints that have been set with Set-PSBreakpoint. Example: Disable the breakpoint with ID 0 and then check its properties to confirm it has been disabled. Disable-PSBreakpoint -id 0 Get-PSBreakpoint -id 0 | Format-List * You will notice that the Enabled property is set to False.

PowerShell 2.0: One Cmdlet at a Time 62 Enable-PSBreakpoint

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Enable-PSBreakpoint cmdlet. What can I do with it? Re-enable debugging breakpoints that have been disabled with Disable-PSBreakpoint. Example: Re-enable breakpoint with ID 0 and then check its properties to confirm it has been enabled. Enable-PSBreakpoint -id 0 Get-PSBreakpoint -id 0 | Format-List * You will notice that the Enabled property is set to True.

PowerShell 2.0: One Cmdlet at a Time 60 Get-PSBreakpoint

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-PSBreakpoint cmdlet. What can I do with it? Retrieve debugging breakpoints that have been set with Set-PSBreakpoint. Examples: Retrieve all current breakpoints. Get-PSBreakpoint Notice the different options which have been set on the breakpoints. Retieve only breakpoints which have been set using the Variable parameter. Get-PSBreakpoint -Type Variable Notice only one breakpoint is returned this time.

PowerShell 2.0: One Cmdlet at a Time 59 Set-PSBreakpoint

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Set-PSBreakPoint cmdlet. What can I do with it? Carry out debugging by setting a breakpoint based on a condition such as line number, command or variable. Examples: Set a breakpoint at line 3 in the script C:\Bowling.ps1 (This is an example script taken from the 2008 Scripting Games. During the execution of the script the variable $iPoints is frequently incremented to a new value) Then run the script to utilise the breakpoint.

PowerShell 2.0: One Cmdlet at a Time 57 Import-PSSession

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Import-PSSession cmdlet. What can I do with it? Import commands from a Remote PowerShell session into the current session, for instance from a remote session on another computer. Example: Establish a remote session with Test01 using New-PSSession. Use Invoke-Command to initiate the use of the BITSTransfer module. Use Import-PSSession to make the contents of the BITSTransfer module available in the local session even though the BITSTransfer module has not been imported on the local computer.

PowerShell 2.0: One Cmdlet at a Time 58 Export-PSSession

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Export-PSSession cmdlet. What can I do with it? Export commands from a remote PowerShell session into a module saved on the local system. Example: Establish a remote session with Test01 using New-PSSession. Use Invoke-Command to initiate the use of the BITSTransfer module. Export the commands from the BITSTransfer module into a module saved on the local system and called BITSCommands.