PowerShell Logo Small

Test-ComputerSecureChannel



This is the built-in help made by Microsoft for the command 'Test-ComputerSecureChannel', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Tests and repairs the secure channel between the local computer and its domain.

SYNTAX


Test-ComputerSecureChannel [-Credential [<PSCredential>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-Repair] [-Server [<String>]] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Test-ComputerSecureChannel cmdlet verifies that the secure channel between the local computer and its domain is working correctly by checking the status of its trust
relationships. If a connection fails, you can use the Repair parameter to try to restore it.


Test-ComputerSecureChannel returns "True" if the secure channel is working correctly and "False" if it is not. This result lets you use the cmdlet in conditional statements
in functions and scripts. To get more detailed test results, use the Verbose parameter.


This cmdlet works much like NetDom.exe. Both NetDom and Test-ComputerSecureChannel use the NetLogon service to perform the actions.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293925
Checkpoint-Computer
Reset-ComputerMachinePassword
Restart-Computer
Stop-Computer

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>test-computersecurechannel
True



This command tests the secure channel between the local computer and the domain to which it is joined.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>test-computersecurechannel -server DCName.fabrikam.com
True



This command specifies a preferred domain controller for the test.










-------------------------- EXAMPLE 3 --------------------------

PS C:\>Test-ComputerSecureChannel -repair
True



This command resets the secure channel between the local computer and its domain.










-------------------------- EXAMPLE 4 --------------------------

PS C:\>test-computerSecureChannel -verbose
VERBOSE: Performing operation "Test-ComputerSecureChannel" on Target "SERVER01".
True
VERBOSE: "The secure channel between 'SERVER01' and 'net.fabrikam.com' is alive and working correctly."



This command uses the Verbose common parameter to request detailed messages about the operation. For more information about the Verbose parameter, see about_CommonParameters.










-------------------------- EXAMPLE 5 --------------------------

PS C:\>set-alias tcsc test-computersecurechannel
if (!(tcsc))
{write-host "Connection failed. Reconnect and retry."}
else { &(.\get-servers.ps1) }



This example shows how to use Test-ComputerSecureChannel to test a connection before running a script that requires the connection.

The first command uses the Set-Alias cmdlet to create an alias for the cmdlet name. This saves space and prevents typing errors.

The If statement checks the value that Test-ComputerSecureChannel returns before running a script.