powershell

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.

PowerShell 2.0: One Cmdlet at a Time 56 Disconnect-WSMan

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Disconnect-WSMan cmdlet. What can I do with it? Disconnect a connection previously made to a remote computer using WS-Management with the Connect-WSMan cmdlet. Example: Disconnect from the remote server Test01 using WS-Management . Disconnect-WSMan -ComputerName Test01 How could I have done this in PowerShell 1.0? Support for the use of WS-Management in PowerShell is provided as part of the 2.

PowerShell 2.0: One Cmdlet at a Time 53 Enable-WSManCredSSP

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Enable-WSManCredSSP cmdlet. What can I do with it? Enable CredSSP authentication on a computer allowing a user’s credentials to be passed to a remote computer for authentication. (Think authentication for background jobs on remote computers.) Note: this cmdlet requires running from an elevated PowerShell session. Example: Enable user credentials on the local computer to be sent to the remote computer Test02.

PowerShell 2.0: One Cmdlet at a Time 54 Get-WSManCredSSP

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-WSManCredSSP cmdlet. What can I do with it? View the CredSSP configuration on the local computer. Note: this cmdlet requires running from an elevated PowerShell session. Example: View the CredSSP configuration on the local computer which has previously been enabled for client CredSSP via Enable-WSManCredSSP. Get-WSManCredSSP You will notice the client part has been enabled, but not the server.