exports/Set-SysManDriver.ps1

<#
.Synopsis
Update or create a driver, if the ids already exists the driver going to be uppdated if not a new will be created.
.Description
Update or create a driver, if the ids already exists the driver going to be uppdated if not a new will be created.
.Link
https://docs.microsoft.com/en-us/powershell/module/sysman.webapi/set-sysmandriver
#>

function Set-SysManDriver {
[OutputType('SysMan.Powershell.Models.IDriver')]
[CmdletBinding(DefaultParameterSetName='Put', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
[SysMan.Powershell.Description('Update or create a driver, if the ids already exists the driver going to be uppdated if not a new will be created.')]
param(
    [Parameter(Mandatory, HelpMessage='The id of the hardware')]
    [SysMan.Powershell.Category('Path')]
    [System.Int64]
    ${HardwareModelId},

    [Parameter(Mandatory, HelpMessage='The id of the operating system')]
    [SysMan.Powershell.Category('Path')]
    [System.Int64]
    ${OperatingSystemId},

    [Parameter(ParameterSetName='Put', ValueFromPipeline, HelpMessage='Represents a driver based on HardwareModel and Operatingsystem')]
    [SysMan.Powershell.Category('Body')]
    [SysMan.Powershell.Models.IDriver]
    ${Driver},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If any additional package (of files) should be downloaded to the client during a inplace upgrade. Note: Only applicable for drivers of type Upgrade')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${AdditionalPackageId},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The driverPackageID, SCCM Driver PakageID format [SiteCode][XXXXX] (exactly 8 alphanumerics)')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${DriverPackageId},

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

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The hardwaremodel that the driver is assosiated with the driver')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${HardwareModelId1},

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

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The OperatingSystem that the driver is assosiated with')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${OperatingSystemId1},

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

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the driver can be used unsigned')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${SoftwareDriverAllowUnsigned},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The additional applications to be installed along with the driver')]
    [SysMan.Powershell.Category('Body')]
    [System.String[]]
    ${SoftwareDriverApplications},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Additonal programs to be executed along with the driver')]
    [SysMan.Powershell.Category('Body')]
    [System.String[]]
    ${SoftwareDriverPrograms},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If DISM/Recurse should be used')]
    [SysMan.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    ${SoftwareDriverUseRecurse},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The type of the driver package')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Type},

    [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-SysManDriver_Put';
            PutExpanded = 'SysMan.WebApi.private\Set-SysManDriver_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
    }
}
}