Patch/Send-PatchInfo.ps1
<#
.SYNOPSIS Sends information about installed patch to a remote server .DESCRIPTION Sends information about installed patch to a remote server defined by Register-PatchHelper command .EXAMPLE Send-PatchInfo -patchLevel "NC" -patchNumber 123 .NOTES #> function Send-PatchInfo { [Alias("sdpai")] [CmdletBinding()] param( [Parameter(Mandatory, ParameterSetName = "patch")] [string]$patchLevel, [Parameter(Mandatory, ParameterSetName = "patch")] [int]$patchNumber, [Parameter(Mandatory, ParameterSetName = "extension")] [string]$ExtensionName, [Parameter(Mandatory, ParameterSetName = "extension")] [string]$ExtensionVersion ) begin { $ErrorActionPreference = "Stop" } process { if ($patchLevel -eq 1) { $patchLevel = "NC" } else { $patchLevel = "NML" } $body = @{} if ($PSCmdlet.ParameterSetName -eq 'patch') { $body = @{ "CustomerName" = $PatchHelperConfig.CustomerName "Artifact" = "patch" "PatchLevel" = $patchLevel "PatchNumber" = $patchNumber } | ConvertTo-Json } else { $body = @{ "CustomerName" = $PatchHelperConfig.CustomerName "Artifact" = "extension" "ExtensionName" = $ExtensionName "ExtensionVersion" = $ExtensionVersion } | ConvertTo-Json } Invoke-WebRequest -Uri $PatchHelperConfig.ReportURL -UseDefaultCredentials -Method Post -ContentType "application/json" -Body $body | Out-Null } end { } } Export-ModuleMember -Alias * -Function * |