< Back

Set-Tls

Sat Jan 11, 2020 1:52 pm

NAME Set-Tls



SYNOPSIS

Sets the TLS settings with only those supplied.





SYNTAX

Set-Tls [-Caller <PSCmdlet>] [-PassThru] -SecurityProtocol {SystemDefault | Ssl3 | Tls | Tls11 | Tls12} [-Confirm]

[-WhatIf] [<CommonParameters>]



Set-Tls [-Caller <PSCmdlet>] [-PassThru] [-Ssl3] [-Tls] [-Tls11] [-Tls12] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

Sets the TLS settings with only those supplied. Settings not supplied will be disabled. For example, if `Ssl3,

Tls` is currently set and `-Tls -Tls11 -Tls12` is supplied the result will be `Tls, Tls11, Tls12`.



If the requested settings and the current settings are the same, no action will be taken.



These TLS Settings are used by `Invoke-WebRequest` and `Invoke-RestMethod` when connecting to remote end points.

These settings may also be used by other .NET APIs. Caution should be used when changing this as you may decrease

your security settings or break access to previously working endpoints.





PARAMETERS

-Caller <PSCmdlet>

This parameter is for internal use only.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

By default, this cmdlet does not supply any output. Supplying `-PassThru` will cause the cmdlet to return the

current TLS configuration.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-SecurityProtocol <SecurityProtocolType>

A `System.Net.SecurityProtocolType` to overwrite the current TLS settings with.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Ssl3 [<SwitchParameter>]

If supplied, SSL 3.0 will be enabled. If not supplied it will be disabled. If no other settings are supplied,

only this setting will be applied. If other settings are supplied, this setting will be enabled along with the

other settings.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Tls [<SwitchParameter>]

If supplied, TLS 1.0 will be enabled. If not supplied it will be disabled. If no other settings are supplied,

only this setting will be applied. If other settings are supplied, this setting will be enabled along with the

other settings.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Tls11 [<SwitchParameter>]

If supplied, TLS 1.1 will be enabled. If not supplied it will be disabled. If no other settings are supplied,

only this setting will be applied. If other settings are supplied, this setting will be enabled along with the

other settings.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Tls12 [<SwitchParameter>]

If supplied, TLS 1.2 will be enabled. If not supplied it will be disabled. If no other settings are supplied,

only this setting will be applied. If other settings are supplied, this setting will be enabled along with the

other settings.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None







OUTPUTS

System.Net.SecurityProtocolType







NOTES





This function is called by `Enable-Tls` and `Disable-Tls`.



-------------------------- Example 1 --------------------------



Set-Tls -Tls -Tls11 -Tls12



This example enables TLS 1.0, 1.1, and 1.2 and disables all other settings.

-------------------------- Example 2 --------------------------



$Setting = [System.Net.SecurityProtocolType]'Tls11, Tls12'

Set-Tls -SecurityProtocol $Setting



This example enables TLS 1.1, and 1.2 and disables all other settings.



RELATED LINKS

https://github.com/markekraus/BetterTls ... Set-Tls.md

https://github.com/markekraus/BetterTls ... Set-Tls.md

Disable-Tls https://github.com/markekraus/BetterTls ... ble-Tls.md

Enable-Tls https://github.com/markekraus/BetterTls ... ble-Tls.md

Get-Tls https://github.com/markekraus/BetterTls ... Get-Tls.md