-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathWS1ModeHealthCheck.ps1
28 lines (28 loc) · 1.3 KB
/
WS1ModeHealthCheck.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
----------------------------------------------------------[Declarations]----------------------------------------------------------
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#-----------------------------------------------------------[Functions]------------------------------------------------------------
$ConnectionServer = ""
$script:hvServer = Connect-HVServer -Server $ConnectionServer -User -Password -Domain
$script:hvServices = $hvServer.ExtensionData
$script:connectionServers = $script:hvServices.connectionserver.ConnectionServer_List()
[System.Collections.ArrayList]$ws1array = @()
foreach($cs in $script:connectionServers){
$name = $cs.general.name
$id = $cs.id
$ws1mode = $cs.Authentication.SamlConfig.WorkspaceONEData.WorkspaceOneModeEnabled
$val = [pscustomobject]@{'Server Name'=$name ;'WS1 Status'=$ws1mode}
$ws1array.add($val) | Out-Null
$val=$null
##Send Email##$
}
$ws1status = $ws1array | Format-List | Out-String
If ($ws1array.("WS1 Status") -match 'False') {
$emailBody = ("Current WS1 Status of Connection Servers:" + $ws1status)
$emailFrom =""
$emailTo = ""
$subject = "Horizon Workspace ONE Mode Health"
$smtpServer = ""
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $emailBody)
}