Functions/Disable-DiffieHellman.ps1
|
function Disable-DiffieHellman { <# .Notes AUTHOR: Skyler Hart CREATED: 04/23/2018 16:38:23 LASTEDIT: 04/23/2018 16:38:23 KEYWORDS: REQUIRES: #Requires -Version 3.0 #Requires -Modules ActiveDirectory #Requires -PSSnapin Microsoft.Exchange.Management.PowerShell.Admin #Requires -RunAsAdministrator .LINK https://wanderingstag.github.io #> [CmdletBinding()] Param ( [Parameter(Mandatory=$false, Position=0)] [Alias('Host','Name','Computer','CN')] [string[]]$ComputerName = "$env:COMPUTERNAME" ) $ValueName = "Enabled" $Valuedata = 0 foreach ($comp in $ComputerName) { #. #. Ciphers #. #Disable Diffie-Hellman ([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $comp)).CreateSubKey('System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms') ([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $comp)).CreateSubKey('System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms\Diffie-Hellman') $BaseKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $comp) $SubKey = $BaseKey.OpenSubKey('System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms\Diffie-Hellman',$true) $SubKey.SetValue($ValueName, $ValueData, [Microsoft.Win32.RegistryValueKind]::DWORD) } }#function disable diffie-hellman |