-
Notifications
You must be signed in to change notification settings - Fork 0
/
WinRM.Tests.ps1
32 lines (24 loc) · 968 Bytes
/
WinRM.Tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$be_computer = hostname
Describe "Local WinRM Services" {
Context "Check WinRM Local Port" {
$Local_ports = @('5985', '5986')
foreach ($port in $Local_ports) {
it "Server is listening on port $port" {
$port_state = Invoke-Command -computer $be_computer `
-ScriptBlock {param($port)(Get-NetTCPConnection -LocalPort $port `
-ErrorAction SilentlyContinue).State} `
-ArgumentList $port
$port_state.Value -contains "Listen" | should be $true
}
}
}
context 'Service WinRM Availability' {
$Services = @('WinRM')
foreach ($ServX in $Services){
it "$ServX is running?" {
$svc = Get-Service -Name $ServX
$svc.Status | Should be running
}
}
}
}