depreciated/Send-UpdateOSDProgress.ps1
function Send-UpdateOSDProgress { [CmdletBinding()] Param ( [Parameter(ParameterSetName = "Phase")] [ValidateSet("Download", "Install", "Finish")] $Phase, [Parameter(ValueFromPipeline, Mandatory = $false, ParameterSetName = "Download")] [int]$PercentComplete, [Parameter(Mandatory = $false, ParameterSetName = "Download")] [string]$DownloadFile, [Parameter(ParameterSetName = "Display-Error")] [String]$DisplayError, [Parameter(ParameterSetName = "Close")] [switch]$CloseServer ) begin { ################### Precheck/Connect #################### $IsRunning = Test-PipeServer if (!$IsRunning) { Write-Warning "no pipe for OSDProgress found, run 'Start-OSDProgressServer' first in diffirent process" break } $clientHash = Connect-PipeServer } process { ################### Build/Send command ################## if ($CloseServer.IsPresent) { $command = "closeServer" } else { $InlineParam = '' foreach ($item in $PSBoundParameters.GetEnumerator()) { $InlineParam += "-$($item.Key)" + " `"$($item.Value)`"" } $command = "Update-OSDProgress $InlineParam" } $clientHash.sw.WriteLine($command) } End { Stop-PipeCommunication -PipeHash $clientHash } } |