exports/Connect-CVServer.ps1


# ----------------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/powershell@4.0.708)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Method to get CommServe authorization token.
.Description
Method to get CommServe authorization token.
.Example
{{ Add code here }}
.Example
{{ Add code here }}
 
.Outputs
Outputs <String> indicating success or failure of login attempt.
.Link
https://learn.microsoft.com/powershell/module/commvaultpowershell/connect-cvserver
#>

function Connect-CVServer {
[CmdletBinding(DefaultParameterSetName='Default', PositionalBinding=$false)]
param(
    [Parameter(Mandatory)]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # The CommServe URL to connect to.
    ${Server},

    [Parameter(ParameterSetName='Default')]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # User name for login.
    ${User},

    [Parameter(ParameterSetName='Default')]
    [Commvault.Powershell.Category('Body')]
    [System.Security.SecureString]
    # Secure password for login.
    ${Password},

    [Parameter(ParameterSetName='PSCredential')]
    [Alias('PSCreds')]
    [ValidateNotNull()]
    [Commvault.Powershell.Category('Body')]
    [System.Management.Automation.PSCredential]
    # Powershell credential object.
    # Used as alternative to -User <user> -Password <password>
    ${Credential}
)

begin {
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $parameterSet = $PSCmdlet.ParameterSetName

        $mapping = @{
            Default = 'CommvaultPowerShell.custom\Connect-CVServer';
            PSCredential = 'CommvaultPowerShell.custom\Connect-CVServer';
        }
        $cmdInfo = Get-Command -Name $mapping[$parameterSet]
        [Commvault.Powershell.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
        [Commvault.Powershell.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
        $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
        $scriptCmd = {& $wrappedCmd @PSBoundParameters}
        $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
        $steppablePipeline.Begin($PSCmdlet)
    } catch {

        throw
    }
}

process {
    try {
        $steppablePipeline.Process($_)
    } catch {

        throw
    }

}
end {
    try {
        $steppablePipeline.End()

    } catch {

        throw
    }
} 
}