Public/Set-bConnectEndpointSecret.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
Function Set-bConnectEndpointSecret() {
    <#
        .Synopsis
            Set disk encryption information for specified endpoint.
        .Parameter EndpointId
            Valid GUID of an endpoint.
        .Parameter Pin
            Current unlock pin for endpoint.
        .Outputs
            Boolean.
    #>


    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'high')]
    [OutputType("System.Boolean")]
    Param (
        [Parameter(Mandatory=$true)][string]$EndpointGuid,
        [Parameter(Mandatory=$true)][string]$Pin
    )

    $_connectVersion = Get-bConnectVersion
    If($_connectVersion -ge "1.0") {
        $_body = @{
            EndpointId = $EndpointGuid;
            Pin = $Pin
        }

        if($PSCmdlet.ShouldProcess($_body.Name, "Set unlock PIN for endpoint.")){
            return Invoke-bConnectPatch -Controller "EndpointSecrets" -Version $_connectVersion -Data $_body
        } else {
            return $false
        }
    } else {
        return $false
    }
}