exports/Set-SysManClientDeployment.ps1

<#
.Synopsis

.Description

.Link
https://docs.microsoft.com/en-us/powershell/module/sysman.webapi/set-sysmanclientdeployment
#>

function Set-SysManClientDeployment {
[OutputType('SysMan.Powershell.Models.IClient', 'SysMan.Powershell.Models.IApiErrorMessage')]
[CmdletBinding(DefaultParameterSetName='Put', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
    [Parameter(Mandatory, HelpMessage='The id of the client')]
    [SysMan.Powershell.Category('Path')]
    [System.Int64]
    ${Id},

    [Parameter(ParameterSetName='Put', ValueFromPipeline, HelpMessage='Upsert a deployment for a client')]
    [SysMan.Powershell.Category('Body')]
    [SysMan.Powershell.Models.IUpdateDeploymentForClientV2Command]
    ${Cmd},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The asset tag. If the asset tag is not provided the serial will be used instead (if Serial is not provided either, assetTag will be set to null on the client).')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${AssetTag},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the dependent resources (systems, groups etc.) of the provided target should be uninstalled/removed before theactual template is applied. Note: The resources will not be cleaned up directly but when the deployment hasactually been performed.If null the value from the configuration will be used.')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${CleanUpDependentResources},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The id of the deployment template to use. If a deployment template is associated with a deployment, the templatewill be applied when the computer exists in external systems.I.e Any Systems or Groups associated with the template will not be applied to the computer until it has beencreated. Note: If a deployment template is used the Roles list will be considered as an override list. If a role is allowed to be overriden by the templateit can be changed by providing it in the Roles List. If a flag role is part of the template and it is marked as canBeChanged and it is not present in the role list the flag is considered as "unchecked" and will not be added to the deployment')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${DeploymentTemplateToUse},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The description of the client. If no description is provided a description will be generated.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Description},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The date the deployment should be executed')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${ExecuteDate},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The hardware object model id. If no hardware model is provided the already existing value on the client will be used. If the client does not have a hardwareModelId and no hardwareModelId is provided the call will fail. If the provided hardwaremodel is inactive the call will fail.')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${HardwareModelId},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The type of installation. The following rules applies when calculating which installationType to use:<ul><li>If installationType is null and template is null then the instalationType will fallback to Required.</li><li>If installationType is null and template is set and the template does not have any default installationType then the instalationType will fallback to required.</li><li>If installationType is null and template is set and the template has a default installationType then the template installationType will be used.</li><li>If installationType is set and template is null then the provided installationType will be used.</li><li>If installationType is set and template is set (and the installationType and default installationType on template is different) then the template has to allow changing installationType otherwise the call will fail.</li></ul>')]
    [SysMan.Powershell.Category('Body')]
    [System.Int32]
    ${InstallationType},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the deployment should be treated as an in-place upgrade or not. Defaults to false.')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${IsUpgrade},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The Mac . Either Mac/Uuid has to be set')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Mac},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The id of the operating system. This value has to be set, either explicit through this property or through the selected deployment template (if applicable). If this value is not set and the selected deployment template does not have a default value for this property the call will fail.')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${OperatingSystemId},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The Primary Users on the client. The list should contain the username of the users that should be assigned as primary user on the client. The list is handles as the desired state so if the list is empty all previously existing primary users will be cleared. If the list is empty all primary users will be removed. If the list is null the primary users for the client (if any is available) will be untoched.')]
    [SysMan.Powershell.Category('Body')]
    [System.String[]]
    ${PrimaryUsers},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The roles that should be applied.')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64[]]
    ${Roles},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The serial number.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Serial},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the actual deployment of the computer should be skipped. If this is true the actual deployment of the computer(or Operating System) will not be performedbut the computer configuration (MAC, UEFI etc.) will be stored in external systems.')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${SkipDeployment},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If wake on lan should be used on the client when deploying the new operating system,If null then the value provided in the SysMan configuration will be used.')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${UseWakeOnLan},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The uuid. Either Mac/Uuid has to be set')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Uuid},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The displayname of the reference')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ValueDisplayName},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The name of the directory resource')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ValueName},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The type of the directory resource')]
    [SysMan.Powershell.Category('Body')]
    [System.Int32]
    ${ValueReferenceType},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The id of the directory resource')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ValueResourceId},

    [Parameter(DontShow, HelpMessage='Wait for .NET debugger to attach')]
    [SysMan.Powershell.Category('Runtime')]
    [System.Management.Automation.SwitchParameter]
    ${Break},

    [Parameter(DontShow, HelpMessage='SendAsync Pipeline Steps to be appended to the front of the pipeline')]
    [ValidateNotNull()]
    [SysMan.Powershell.Category('Runtime')]
    [SysMan.Powershell.Runtime.SendAsyncStep[]]
    ${HttpPipelineAppend},

    [Parameter(DontShow, HelpMessage='SendAsync Pipeline Steps to be prepended to the front of the pipeline')]
    [ValidateNotNull()]
    [SysMan.Powershell.Category('Runtime')]
    [SysMan.Powershell.Runtime.SendAsyncStep[]]
    ${HttpPipelinePrepend},

    [Parameter(DontShow, HelpMessage='The URI for the proxy server to use')]
    [SysMan.Powershell.Category('Runtime')]
    [System.Uri]
    ${Proxy},

    [Parameter(DontShow, HelpMessage='Credentials for a proxy server to use for the remote call')]
    [ValidateNotNull()]
    [SysMan.Powershell.Category('Runtime')]
    [System.Management.Automation.PSCredential]
    ${ProxyCredential},

    [Parameter(DontShow, HelpMessage='Use the default credentials for the proxy')]
    [SysMan.Powershell.Category('Runtime')]
    [System.Management.Automation.SwitchParameter]
    ${ProxyUseDefaultCredentials}
)

begin {
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $parameterSet = $PsCmdlet.ParameterSetName
        $mapping = @{
            Put = 'SysMan.WebApi.private\Set-SysManClientDeployment_Put';
            PutExpanded = 'SysMan.WebApi.private\Set-SysManClientDeployment_PutExpanded';
        }
        $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
    }
}
}