exports/Set-SysManClientHealth.ps1

<#
.Synopsis
Updates the latest entry for a target. If no health entry exists for the provided target a new health entry will be created.\r\nIf this method is called with a computer account, it is only possible to report health on that computer (TargetId and TargetName will be ignored). If called with a user account TargetId and TargetName will be honored.
.Description
Updates the latest entry for a target. If no health entry exists for the provided target a new health entry will be created.\r\nIf this method is called with a computer account, it is only possible to report health on that computer (TargetId and TargetName will be ignored). If called with a user account TargetId and TargetName will be honored.
.Link
https://docs.microsoft.com/en-us/powershell/module/sysman.webapi/set-sysmanclienthealth
#>

function Set-SysManClientHealth {
[OutputType('SysMan.Powershell.Models.IComputerHealth', 'SysMan.Powershell.Models.IApiErrorMessage')]
[CmdletBinding(DefaultParameterSetName='Put', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
[SysMan.Powershell.Description('Updates the latest entry for a target. If no health entry exists for the provided target a new health entry will be created.\r\nIf this method is called with a computer account, it is only possible to report health on that computer (TargetId and TargetName will be ignored). If called with a user account TargetId and TargetName will be honored.')]
param(
    [Parameter(ParameterSetName='Put', ValueFromPipeline, HelpMessage='Represent a computer health entry.')]
    [SysMan.Powershell.Category('Body')]
    [SysMan.Powershell.Models.IComputerHealth]
    ${Health},

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

    [Parameter(ParameterSetName='PutExpanded', Mandatory, HelpMessage='Which processor architecture is used')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Architecture},

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

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Configuration Manager Client cache size')]
    [SysMan.Powershell.Category('Body')]
    [System.Int32]
    ${CacheSize},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the Configuration Manager client certificate check')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ClientCertificate},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The date when ConfigMgr Client Health installed the Configuration Manager Client')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${ClientInstalled},

    [Parameter(ParameterSetName='PutExpanded', Mandatory, HelpMessage='Configuration Manager Client Version')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ClientVersion},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The date the health entry was created')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${CreatedDate},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the DNS check. If ''Error'', Verify specific log file for more information on this error. The DNS server have registered an IP address for the hostname that is not present on the specific computer, and the IP addresses are listed in the log file.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Dns},

    [Parameter(ParameterSetName='PutExpanded', Mandatory, HelpMessage='The domain the computer is joined to')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Domain},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the driver check. Verify specific log file for more information on this error. The drivers with errors are listed in the log file')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Drivers},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Latest timestamp when hardware inventory ran on the client')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${HwInventory},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The id of this health entry. Only populated if using SysMan health component')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${Id},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Date and time when the computer was installed')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${InstallDate},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The last time the client was rebooted')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${LastBootTime},

    [Parameter(ParameterSetName='PutExpanded', Mandatory, HelpMessage='The username who last logged on the computer')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${LastLoggedOnUser},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The date the health entry was updated')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${LastModified},

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

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Configuration Manager Client max number of log history files')]
    [SysMan.Powershell.Category('Body')]
    [System.Int32]
    ${MaxLogHistory},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Configuration Manager Client max size for log files')]
    [SysMan.Powershell.Category('Body')]
    [System.Int32]
    ${MaxLogSize},

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

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Free space in percent on the C: drive')]
    [SysMan.Powershell.Category('Body')]
    [System.Double]
    ${OSDiskFreeSpace},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Date and time when the computer installed its latest patch.')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${OSUpdates},

    [Parameter(ParameterSetName='PutExpanded', Mandatory, HelpMessage='Operating system of the computer')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${OperatingSystem},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the pending reboot check')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${PendingReboot},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the Configuration Manager Client provisioning mode check')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ProvisioningMode},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Powershell build number')]
    [SysMan.Powershell.Category('Body')]
    [System.Int32]
    ${PsBuild},

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

    [Parameter(ParameterSetName='PutExpanded', Mandatory, HelpMessage='The state of the services check.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Services},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Configuration Manager Client Sitecode')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Sitecode},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the StateMesasges check. Verifies that the client successfully sends state messages to the management point')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${StateMessages},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The id of the target (client) associated with this health entry. Only populated if using SysMan health component.')]
    [SysMan.Powershell.Category('Body')]
    [System.Int64]
    ${TargetId},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The name of the target (client) associated with this health entry')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${TargetName},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Latest execution time of the script')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${Timestamp},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the update check. Updates attempted to install on last execution is listed here')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Updates},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The version of ConfigMgr Client Health script executed by the computer.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Version},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the WMI check')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Wmi},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The state of the WUAHandler check. Performs check on Windows Update Agent Handler and registry.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${WuaHandler},

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