powershell

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.

PowerShell 2.0: One Cmdlet at a Time 48 Get-WSManInstance

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-WSManInstance cmdlet. What can I do with it? Retrieve an instance of a management resource specified by a URI by using WS-Management. Examples: Display management information for the BITS service on the remote computer Test01. Get-WSManInstance wmicimv2/win32_service -selectorset @{name=“BITS”} -computername Test01 Notice that you receive many properties for the BITS service. Display management information for the WS-Management listener configuration on the remote computer Test01.

PowerShell 2.0: One Cmdlet at a Time 46 Test-WSMan

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Test-WSMan cmdlet. What can I do with it? Test whether WS-Management is available on a computer. Example: Test whether WS-Management is available on Test01. Test-WSMan -ComputerName Test01 You will notice you receive a response detailing wsmid, ProtocolVersion, ProductVendor and ProductVersion if the query is successful. How could I have done this in PowerShell 1.