cmdlet-series

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.

PowerShell 2.0: One Cmdlet at a Time 55 Disable-WSManCredSSP

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Disable-WSManCredSSP cmdlet. What can I do with it? Disable CredSSP configuration on a computer. Note: this cmdlet requires running from an elevated PowerShell session. Example: Disable the CredSSP configuration on the local computer which has previously been enabled for client CredSSP via Enable-WSManCredSSP. Confirm this has been successful with Get-WSManCredSSP. Disable-WSManCredSSP -Role client Get-WSManCredSSP

PowerShell 2.0: One Cmdlet at a Time 52 New-WSManSessionOption

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-WSManSessionOption cmdlet. What can I do with it? Create a session option hash table for use with the WS-Management cmdlets Get-WSManInstance, Set-WSManInstance, Invoke-WSManAction and Connect-WSMan. Example: Create a session option hash table for use with the Set-WSManInstance cmdlet to update the HTTPS listener created with New-WSManInstance . $options = New-WSManSessionOption -OperationTimeout 1000 -SkipRevocationCheck Set-WSManInstance winrm/config/listener -SelectorSet @{address="*";transport=“https”} -SessionOption $options

PowerShell 2.0: One Cmdlet at a Time 51 Remove-WSManInstance

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-WSManInstance cmdlet. What can I do with it? Remove a management resource that has been previously created for use with WS-Management. Example: Check for existing HTTPS Listeners. Remove the existing HTTPS listener created with New-WSManInstance . Check again to confirm its removal. Get-WSManInstance winrm/config/listener -selectorset @{Address="*";Transport=“https”} Remove-WSManInstance winrm/config/listener -SelectorSet @{address="*";transport=“https”} Get-WSManInstance winrm/config/listener -selectorset @{Address="*";Transport=“https”}

PowerShell 2.0: One Cmdlet at a Time 50 Set-WSManInstance

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Set-WSManInstance cmdlet. What can I do with it? Change the properties of a management resource for use with WS-Management. Example: Set the Enabled property of the HTTPS listener created with New-WSManInstance to false, effectively disabling it. Tip: watch out for case sensitivity in ValueSet Set-WSManInstance winrm/config/listener -SelectorSet @{address="*";transport=“https”} -ValueSet @{Enabled=“false”} How could I have done this in PowerShell 1.

PowerShell 2.0: One Cmdlet at a Time 49 New-WSManInstance

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-WSManInstance cmdlet. What can I do with it? Create an instance of a management resource for use with WS-Management. Example: Create an instance of a management resource for use with WS-Management using HTTPS. You need to specify a certificate for use with this listener since it is HTTPS. For testing purposes it is possible to create a self-signed certificate within IIS.