20 lines
974 B
PowerShell
20 lines
974 B
PowerShell
$ErrorActionPreference = 'Continue'
|
|
Write-Output '=== WinRM service ==='
|
|
Get-Service WinRM | Select-Object Name, Status, StartType | Format-Table -AutoSize
|
|
Write-Output '=== Test-WSMan localhost ==='
|
|
try { Test-WSMan -ComputerName neptune -ErrorAction Stop | Out-String } catch { Write-Output "FAIL: $($_.Exception.Message)" }
|
|
Write-Output '=== WinRM listeners ==='
|
|
winrm enumerate winrm/config/listener 2>&1
|
|
Write-Output '=== Exchange PowerShell vdir session test ==='
|
|
try {
|
|
$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://neptune/PowerShell/ -Authentication Kerberos -ErrorAction Stop
|
|
Write-Output "SESSION OK: $($s.State)"
|
|
Remove-PSSession $s
|
|
} catch { Write-Output "FAIL: $($_.Exception.Message)" }
|
|
Write-Output '=== plain PSSession test ==='
|
|
try {
|
|
$s2 = New-PSSession -ComputerName neptune -ErrorAction Stop
|
|
Write-Output "SESSION OK: $($s2.State)"
|
|
Remove-PSSession $s2
|
|
} catch { Write-Output "FAIL: $($_.Exception.Message)" }
|