Set-RpMutexLogAndUI¶
SYNOPSIS¶
Logs a message and updates a UI element with the same message.
SYNTAX¶
LogAndUI (Default)¶
Set-RpMutexLogAndUI [-MutexName <String>] -LogPath <String> -Message <String> [-UiElement <TextBox>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
LogOnly¶
Set-RpMutexLogAndUI [-MutexName <String>] -LogPath <String> -Message <String>
[-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION¶
This function logs a message to a specified log file and updates a UI element (TextBox) with the same message. If the UI element is not provided, it will only log the message.
EXAMPLES¶
EXAMPLE 1¶
Set-RpMutexLogAndUI -logPath "$(Get-RpLogPath)" -message "Task completed." -uiElement $textBoxElement
This example logs the message "Task completed." to the log file and updates the UI element with the same message.
EXAMPLE 2¶
This example logs the message "Task completed." to the log file without updating the UI.
PARAMETERS¶
-MutexName¶
The name of the Mutex used to ensure exclusive access. Defaults to a GUID.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: [System.Guid]::NewGuid().ToString()
Accept pipeline input: False
Accept wildcard characters: False
-LogPath¶
The path to the log file where the message will be recorded.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Message¶
The actual text that will be logged and optionally shown in the UI.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-UiElement¶
The TextBox UI element to be updated with the message.
Type: TextBox
Parameter Sets: LogAndUI
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.