Public/Test-SmbSigning.ps1

function Test-SmbSigning {
    <#
    .SYNOPSIS
        Reports whether SMB signing is required on the client and server sides.
    .DESCRIPTION
        Reads the RequireSecuritySignature DWORD value from both the LanManWorkstation
        (SMB client) and LanManServer (SMB server) registry keys and returns the current
        configuration. A value of 1 means signing is required; 0 means it is not enforced.
    .INPUTS
        None. Parameters must be supplied directly.
    .OUTPUTS
        System.Management.Automation.PSCustomObject
    .PARAMETER ComputerName
        The target computer. Defaults to the local machine.
    .EXAMPLE
        Test-SmbSigning

        Returns SMB signing state on the local machine.
    .EXAMPLE
        Test-SmbSigning -ComputerName 'Server01'

        Returns SMB signing state on Server01.
    .EXAMPLE
        'Server01','Server02' | ForEach-Object { Test-SmbSigning -ComputerName $_ }

        Returns SMB signing state for multiple machines.
    .NOTES
        Read-only. Does not modify any system state.
        Use Enable-SmbSigning to enforce signing on the client side.
        Remote operations require WinRM to be configured on the target machine.
    #>


    [CmdletBinding()]
    [OutputType([System.Management.Automation.PSCustomObject])]

    param (
        [Parameter(Mandatory = $false)]
        [string]$ComputerName = $env:COMPUTERNAME
    )

    $isLocal = ($ComputerName -ieq $env:COMPUTERNAME) -or
               ($ComputerName -ieq 'localhost') -or
               ($ComputerName -eq '127.0.0.1')

    $read = {
        $clientPath = 'HKLM:\System\CurrentControlSet\Services\LanManWorkstation\Parameters'
        $serverPath = 'HKLM:\System\CurrentControlSet\Services\LanManServer\Parameters'

        $clientValue = (Get-ItemProperty -Path $clientPath -ErrorAction SilentlyContinue).RequireSecuritySignature
        $serverValue = (Get-ItemProperty -Path $serverPath -ErrorAction SilentlyContinue).RequireSecuritySignature

        [PSCustomObject]@{
            ClientSigningRequired = ($clientValue -eq 1)
            ServerSigningRequired = ($serverValue -eq 1)
        }
    }

    if ($isLocal) {
        $result = & $read
    } else {
        $result = Invoke-Command -ComputerName $ComputerName -ScriptBlock $read
    }

    [PSCustomObject]@{
        ComputerName          = $ComputerName
        ClientSigningRequired = $result.ClientSigningRequired
        ServerSigningRequired = $result.ServerSigningRequired
    }
}