< Back

Write-PSFMessageProxy

Sun Jan 19, 2020 6:46 pm

NAME Write-PSFMessageProxy



SYNOPSIS

A proxy command that allows smoothly redirecting messages to Write-PSFMessage.





SYNTAX

Write-PSFMessageProxy [[-Message] <String>] [-NoNewline] [-Separator <Object>] [-ForegroundColor {Black | DarkBlue

| DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red |

Magenta | Yellow | White}] [-BackgroundColor {Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta |

DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}] [-Tags <String[]>]

[<CommonParameters>]





DESCRIPTION

This function is designed to pick up the alias it was called by and to redirect the message that was sent to

Write-PSFMessage.

For example, by creating an alias for Write-Host pointing at 'Write-PSFMessageProxy' will cause it to redirect the

message at 'Important' level (which is written to host by default, but also logged).



By creating those aliases, it becomes easy to shift current scripts to use the logging, without having to actually

update the code.





PARAMETERS

-Message <String>

The message to write.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoNewline [<SwitchParameter>]

Dummy parameter to make Write-Host redirection happy.

IT WILL BE IGNORED!



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Separator <Object>

Dummy parameter to make Write-Host redirection happy.

IT WILL BE IGNORED!



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ForegroundColor

Configure the foreground color for host messages.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BackgroundColor

Dummy parameter to make Write-Host redirection happy.

IT WILL BE IGNORED!



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tags <String[]>

Add tags to the messages.



Required? false

Position? named

Default value proxied

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Write-PSFMessageProxy "Example Message"



Will write the message "Example Message" to verbose.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-Alias Write-Host Write-PSFMessageProxy



PS C:\\> Write-Host "Example Message"



This will create an alias named "Write-Host" pointing at "Write-PSFMessageProxy".

Then it will write the message "Example Message", which is automatically written to Level "Important" (which by

default will be written to host).











RELATED LINKS





CommonParameters : True

WorkflowCommonParameters : False

details : @{name=ConvertTo-PSFHashtable; noun=PSFHashtable; verb=ConvertTo}

Syntax : @{syntaxItem=System.Object[]}

parameters : @{parameter=System.Object[]}

inputTypes : @{inputType=}

returnValues : @{returnValue=}

aliases : None



remarks : None

PSSnapIn :

alertSet :

description :

examples :

Synopsis :

ConvertTo-PSFHashtable [-Include <string[]>] [-Exclude <string[]>] [-IncludeEmpty]

[-Inherit] [-InputObject <psobject[]>] [<CommonParameters>]



ModuleName : PSFramework

nonTerminatingErrors :

xmlns:command : http://schemas.microsoft.com/maml/dev/command/2004/10

xmlns:dev : http://schemas.microsoft.com/maml/dev/2004/10

xmlns:maml : http://schemas.microsoft.com/maml/2004/10

Name : ConvertTo-PSFHashtable

Category : Cmdlet

Component :

Role :

Functionality :





CommonParameters : True

WorkflowCommonParameters : False

details : @{name=Invoke-PSFCallback; noun=PSFCallback; verb=Invoke}

Syntax : @{syntaxItem=System.Object[]}

parameters : @{parameter=System.Object[]}

inputTypes : @{inputType=}

returnValues : @{returnValue=}

aliases : None



remarks : None

PSSnapIn :

alertSet :

description :

examples :

Synopsis :

Invoke-PSFCallback [-Data <Object>] [-EnableException <bool>] [-PSCmdlet <PSCmdlet>]

[<CommonParameters>]



ModuleName : PSFramework

nonTerminatingErrors :

xmlns:command : http://schemas.microsoft.com/maml/dev/command/2004/10

xmlns:dev : http://schemas.microsoft.com/maml/dev/2004/10

xmlns:maml : http://schemas.microsoft.com/maml/2004/10

Name : Invoke-PSFCallback

Category : Cmdlet

Component :

Role :

Functionality :