forked from gildas/posh-ic
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGet-ICMediaServerStatus.ps1
49 lines (45 loc) · 1.86 KB
/
Get-ICMediaServerStatus.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<#
# AUTHOR : Paul McGurn
# DATE : 02/10/2021
#>
#NOTE: Media Server REST API is not enabled by default. If this command returns a error 404 or 401, that is likely why.
function Get-ICMediaServerStatus() {
<#
.SYNOPSIS
Returns the media server / command server status for each linked CIC server in an arraylist
.DESCRIPTION
Returns the media server / command server status for each linked CIC server in an arraylist
.PARAMETER Server
The media server to query
.PARAMETER User
The media server username to log on with
.PARAMETER Password
The media server password to log on with. Must be of type System.SecureString for adequate runtime security.
.PARAMETER UseHttps
Whether to use http (default) or https to interace with Media Server REST API. The Media server needs to have these two settings enabled
in order to use https
* Recording Retrieval Use Mutual Authentication
* Recording Retrieval HTTPS Required
.EXAMPLE
$user = 'someuser'
$password = ConvertTo-SecureString 'Super$strong##' -AsPlainText
$s = Get-ICMediaServerStatus -Server 'mymediaserver.example.com' -User $user -Password $password
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)] [Alias("Computer", "MediaServer")] $Server,
[Parameter(Mandatory = $true)] [Alias("username", "id")] $User,
[Parameter(Mandatory = $true)] [Alias("pass")] [SecureString]$Password,
[Parameter(Mandatory = $false)] [bool] $UseHttps = $false
)
$cred = New-Object System.Management.Automation.PSCredential $User, $Password
if ($UseHttps) {
$protocol = 'https://'
}
else {
$protocol = 'http://'
}
$uri = $protocol + $server + ":8102/api/v1/commandservers" #Port 8102 is the default port for this API
$response = Invoke-RestMethod -Uri $uri -Method GET -Credential $cred -AllowUnencryptedAuthentication
$response.commandServers
}