Functions/Authentication/Enable-DomainCredSSP.ps1

Function Enable-DomainCredSSP
{
    [cmdletbinding()]
    Param()
    Process
    {
        # Enable Remoting
        $EN = Enable-PSRemoting -force

        # Enable CredSSP Client Role
        $EN_WS1 = Enable-WSManCredSSP -Role Client -DelegateComputer locahost -Force
        $EN_WS2 = Enable-WSManCredSSP -Role Client -DelegateComputer $env:COMPUTERNAME -Force
        $EN_WS3 = Enable-WSManCredSSP -Role Client -DelegateComputer $domain -Force
        $EN_WS4 = Enable-WSManCredSSP -Role Client -DelegateComputer "*.$domain" -Force
        $SET_WS = Set-Item -Path "wsman:\localhost\service\auth\credSSP" -Value $True -Force

        # Enable NTLM Fresh in Registry
        $R_1 = New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -Name AllowFreshCredentialsWhenNTLMOnly -Force
        $R_2 = New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentialsWhenNTLMOnly -Name 1 -Value * -PropertyType String
    }
}