$secPassword = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $secPassword)

Write-Output "Testing Negotiate auth..."
try {
    $result = Invoke-Command -ComputerName 192.168.0.27 -Credential $cred -Authentication Negotiate -ScriptBlock { hostname } -ErrorAction Stop
    Write-Output "[OK] Negotiate: $result"
} catch {
    Write-Output "[FAIL] Negotiate: $_"
}

Write-Output "`nTesting Default auth..."
try {
    $result = Invoke-Command -ComputerName 192.168.0.27 -Credential $cred -ScriptBlock { hostname } -ErrorAction Stop
    Write-Output "[OK] Default: $result"
} catch {
    Write-Output "[FAIL] Default: $_"
}

Write-Output "`nTesting with SessionOption..."
try {
    $so = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
    $result = Invoke-Command -ComputerName 192.168.0.27 -Credential $cred -Authentication Negotiate -SessionOption $so -ScriptBlock { hostname } -ErrorAction Stop
    Write-Output "[OK] SessionOption: $result"
} catch {
    Write-Output "[FAIL] SessionOption: $_"
}
