-
Notifications
You must be signed in to change notification settings - Fork 0
/
Eventlog.Tests.ps1
32 lines (24 loc) · 971 Bytes
/
Eventlog.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 Eventlog Services" {
Context "Check Local Eventlog Port" {
$Local_ports = @('135')
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 Eventlog Availability' {
$Services = @('Eventlog')
foreach ($ServX in $Services){
it "$ServX is running?" {
$svc = Get-Service -Name $ServX
$svc.Status | Should be running
}
}
}
}