exports/New-SysManClient.ps1

<#
.Synopsis
Creates a new client. A new client has have a unique name, mac or UUID. Validating of a client can be done by\r\nutilizing the ValidateName, ValidateMac and ValidateUuid methods.\r\nWill only create the client in SysMan. An action will be created with type 'ADDTARGET' that can be used by\r\nexternal systems to continue with the deployment.
.Description
Creates a new client. A new client has have a unique name, mac or UUID. Validating of a client can be done by\r\nutilizing the ValidateName, ValidateMac and ValidateUuid methods.\r\nWill only create the client in SysMan. An action will be created with type 'ADDTARGET' that can be used by\r\nexternal systems to continue with the deployment.
.Link
https://docs.microsoft.com/en-us/powershell/module/sysman.webapi/new-sysmanclient
#>

function New-SysManClient {
[OutputType('SysMan.Powershell.Models.IClient', 'SysMan.Powershell.Models.IApiErrorMessage')]
[CmdletBinding(DefaultParameterSetName='Create', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
[SysMan.Powershell.Description('Creates a new client. A new client has have a unique name, mac or UUID. Validating of a client can be done by\r\nutilizing the ValidateName, ValidateMac and ValidateUuid methods.\r\nWill only create the client in SysMan. An action will be created with type ''ADDTARGET'' that can be used by\r\nexternal systems to continue with the deployment.')]
param(
    [Parameter(ParameterSetName='Create', ValueFromPipeline, HelpMessage='Creates a a new client (Target)')]
    [SysMan.Powershell.Category('Body')]
    [SysMan.Powershell.Models.ICreateNewClientCommand]
    ${Cmd},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The asset tag of the client')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${AssetTag},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='If the client should be created in Active Directory. If null the value defaults to true.')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${CreateInActiveDirectory},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='If the client should be created in the external system. If null the value defaults to true.')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${CreateInExternal},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='If the client should be created in SCCM.')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${CreateInSccm},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The computer description')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Description},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='GeneralMessage')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${GeneralMessage},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='Has GeneralMessage')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${HasGeneralMessage},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='If the client should be active or not. An active client is searchable while an inactive client is not')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${IsActive},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='If the client is a ''Medicinteknisk utrusting''')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${IsMt},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The Mac')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Mac},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The model the current computer has')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${Model},

    [Parameter(ParameterSetName='CreateExpanded', Mandatory, HelpMessage='The name')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Name},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='If the Client shuld be overwriten if the client already exists')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${OverWrite},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='If the client is actually owned by some other external system. This will prevent the computer from being deleted through the SysMan UI.Note: The computer will still be able to be deleted through this API.')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${OwnedByExternalSystem},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The target id of the owners')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64[]]
    ${Owners},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The primary users to add to the client. The list should contain the userName of the users to add. The PrimaryUsers information is owned by SCCM (therefor the userName instead of targetId).')]
    [SysMan.Powershell.Category('Body')]
    [System.String[]]
    ${PrimaryUsersToAdd},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The serial of the client')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Serial},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='Where the client was imported from (Example: SysManService)')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Source},

    [Parameter(ParameterSetName='CreateExpanded', HelpMessage='The Uuid')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Uuid},

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

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

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

    [Parameter(ParameterSetName='CreateExpanded', 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 = @{
            Create = 'SysMan.WebApi.private\New-SysManClient_Create';
            CreateExpanded = 'SysMan.WebApi.private\New-SysManClient_CreateExpanded';
        }
        $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
    }
}
}