-
Notifications
You must be signed in to change notification settings - Fork 0
/
LicenseStatus.Tests.ps1
34 lines (30 loc) · 1.09 KB
/
LicenseStatus.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
33
34
$Remote_computer = '192.168.68.52'
Describe "LicenseStatus" {
Context "Checking LicenseStatus" {
it "Server is License" {
$Lic = Get-CimInstance -ClassName SoftwareLicensingProduct | where {$_.productkeyid} | SELECT LicenseStatus
$Lic.LicenseStatus | should be '1'
}
}
Context "Check Remote KMS Port" {
$Remote_ports = @('1688')
foreach ($port in $Remote_ports) {
$socket = New-Object Net.Sockets.TcpClient
it "Server is listening on port $port" {
Try{
$socket.Connect($Remote_computer, $port)
$Result = 'Success'
}
Catch{
Write-Host $_
$Result = 'Failed'
}
Finally{
$socket.Close()
$socket.Dispose()
}
$Result -contains 'Success' | should be $true
}
}
}
}