Skip to content

echalone/Test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Module Name Module Guid Module Version Locale
TUN.Logging
eeac1534-25a5-4429-a073-17ec769525f5
1.2.0
en-US

TUN.Logging Module

Description

Provides easy to use file and mail logging. Documentation of module at https://github.com/echalone/TUN/blob/master/PowerShell/Modules/TUN.Logging/TUN.Logging.md

Required Modules

  • TUN.Credentials (1.1.0)

Content

TUN.Logging Cmdlets

Get-HasLogDebug

SYNOPSIS

Determines if debug messages were logged to the log file (so far).

SYNTAX

Get-HasLogDebug [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been debug messages logged to the log file

False...No debug messages have yet been logged to the log file

Get-HasLogError

SYNOPSIS

Determines if errors were logged to the log file (so far).

SYNTAX

Get-HasLogError [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been errors logged to the log file

False...No errors have yet been logged to the log file

Get-HasLogHost

SYNOPSIS

Determines if host messages were logged to the log file (so far).

SYNTAX

Get-HasLogHost [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been host messages logged to the log file

False...No host messages have yet been logged to the log file

Get-HasLogInformation

SYNOPSIS

Determines if information messages were logged to the log file (so far).

SYNTAX

Get-HasLogInformation [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been information messages logged to the log file

False...No information messages have yet been logged to the log file

Get-HasLogOutput

SYNOPSIS

Determines if output messages were logged to the log file (so far).

SYNTAX

Get-HasLogOutput [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been output messages logged to the log file

False...No output messages have yet been logged to the log file

Get-HasLogVerbose

SYNOPSIS

Determines if verbose messages were logged to the log file (so far).

SYNTAX

Get-HasLogVerbose [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been verbose messages logged to the log file

False...No verbose messages have yet been logged to the log file

Get-HasLogWarning

SYNOPSIS

Determines if warnings were logged to the log file (so far).

SYNTAX

Get-HasLogWarning [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been warnings logged to the log file

False...No warnings have yet been logged to the log file

Get-HasMailLogDebug

SYNOPSIS

Determines if debug messages were logged to the mail log (so far).

SYNTAX

Get-HasMailLogDebug

OUTPUTS

True....There have been debug messages logged to the mail log

False...No debug messages have yet been logged to the mail log

Get-HasMailLogError

SYNOPSIS

Determines if errors were logged to the mail log (so far).

SYNTAX

Get-HasMailLogError [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations for which to get the information for. Default is $null the information will be retrieved for all running text configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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.

OUTPUTS

True....There have been errors logged to the mail log

False...No errors have yet been logged to the mail log

Get-HasMailLogHost

SYNOPSIS

Determines if host messages were logged to the mail log (so far).

SYNTAX

Get-HasMailLogHost

OUTPUTS

True....There have been host messages logged to the mail log

False...No host messages have yet been logged to the mail log

Get-HasMailLogInformation

SYNOPSIS

Determines if information messages were logged to the mail log (so far).

SYNTAX

Get-HasMailLogInformation

OUTPUTS

True....There have been information messages logged to the mail log

False...No information messages have yet been logged to the mail log

Get-HasMailLogOutput

SYNOPSIS

Determines if output messages were logged to the mail log (so far).

SYNTAX

Get-HasMailLogOutput

OUTPUTS

True....There have been output messages logged to the mail log

False...No output messages have yet been logged to the mail log

Get-HasMailLogVerbose

SYNOPSIS

Determines if verbose messages were logged to the mail log (so far).

SYNTAX

Get-HasMailLogVerbose

OUTPUTS

True....There have been verbose messages logged to the mail log

False...No verbose messages have yet been logged to the mail log

Get-HasMailLogWarning

SYNOPSIS

Determines if warnings were logged to the mail log (so far).

SYNTAX

Get-HasMailLogWarning

OUTPUTS

True....There have been warnings logged to the mail log

False...No warnings have yet been logged to the mail log

Get-TUNLoggingVersion

SYNOPSIS

Returns version of current TUN.Logging module

SYNTAX

Get-TUNLoggingVersion [-AsString] [<CommonParameters>]

PARAMETERS

-AsString

True/Present...will return a version string False/Absent...will return a version object

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: False
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.

OUTPUTS

Version of TUN.Logging module

Send-Log

SYNOPSIS

Stops logging process for mail log and sends the mail log text as a text mail. Optionally attaches the file log as attachment.

SYNTAX

Send-Log [-From] <String> [-To] <String[]> [[-SmtpServer] <String>] [[-Subject] <String>]
 [[-ConfigurationName] <String>] [[-AttachLogFileConfigurations] <String[]>] [[-UserName] <String>]
 [[-Password] <SecureString>] [-UseSsl] [-AlwaysSend] [-SendOnError] [-SendOnHost] [-SendOnOutput]
 [-SendOnVerbose] [-SendOnWarning] [-SendOnDebug] [-SendOnInformation] [-AttachLogfile] [-KeepLogging]
 [-WhatIf] [-Confirm] [<CommonParameters>]

PARAMETERS

-From

The from email address.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-To

The to email address. Can be one or more email addresses to which the email will be sent.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SmtpServer

The SMTP server to use for sending the email. If this parameter is not provided, the default SMTP server as defined in $PSEmailServer will be used.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: $PSEmailServer
Accept pipeline input: False
Accept wildcard characters: False
-Subject

The beginning of the subject line of the email. Will interpret $(COMPUTERNAME) and $(SCRIPTNAME) as variables. If not provided, will use "Notification from $(COMPUTERNAME)/$(SCRIPTNAME)" as default. The reason for the E-Mail sending will be added to the end of the subject line (sepearted by a comma).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to send emails for. The default is $null and will... a) Check if a DefaultMailLog configuration exists and send that b) If no DefaultMailLog configuration exists, will send all running text logs as their own mail

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AttachLogFileConfigurations

Will attach log files of the provided configurations, if their file logging is enabled.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-UserName

The user to use for authentication at the smtp server. Default is $null and will either use Credentials-File or current user (depending on if credentials file was provided).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Password

The password to use for authentication at the smtp server.

Type: SecureString
Parameter Sets: (All)
Aliases:

Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-UseSsl

True/Present...Will use Ssl to connect to the smtp server

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AlwaysSend

True/Present...Will always send the email, no matter what exactly was logged.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SendOnError

True/Present...Will send the email if an error occured and was logged in the mail text.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SendOnHost

True/Present...Will send the email if an error occured and was logged in the mail text.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SendOnOutput

True/Present...Will send the email if an error occured and was logged in the mail text.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SendOnVerbose

True/Present...Will send the email if an error occured and was logged in the mail text.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SendOnWarning

True/Present...Will send the email if an error occured and was logged in the mail text.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SendOnDebug

True/Present...Will send the email if an error occured and was logged in the mail text.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SendOnInformation

True/Present...Will send the email if an error occured and was logged in the mail text.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AttachLogfile

True/Present...Will attach the log file of the configuration to the log mail if file logging was enabled for that configuration.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-KeepLogging

True/Present...Will not stop the logs for which an email was sent

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None

NOTES

Once this function has been called, the Write-ErrorLog etc. functions will not add any more lines to the mail log.

Set-ForceLogSend

SYNOPSIS

Sets a flag to trigger the sending of the log mail as soon as Send-Log is called (no matter what messages have been logged).

SYNTAX

Set-ForceLogSend [[-Reason] <String>] [[-ConfigurationName] <String[]>] [<CommonParameters>]

PARAMETERS

-Reason

The reason for force sending of mail log (will be added to subject line). If no reason is given here, "forced" will be given as reason in the subject line.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations for which to force log sending. Default is $null and all running text configurations will be forced to send.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
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.

OUTPUTS

None

Set-LogFallbackConsoleColors

SYNOPSIS

Sets global fallback colors for console output (needed fox linux).

SYNTAX

Set-LogFallbackConsoleColors [[-FallbackForegroundColor] <ConsoleColor>]
 [[-FallbackBackgroundColor] <ConsoleColor>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Sets global fallback colors for console output (needed fox linux).

PARAMETERS

-FallbackForegroundColor

The fallback foreground color for the console if none was provided and the current foreground color could not be determined from the console. The default is Gray.

Type: ConsoleColor
Parameter Sets: (All)
Aliases:
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White

Required: False
Position: 1
Default value: Gray
Accept pipeline input: False
Accept wildcard characters: False
-FallbackBackgroundColor

The fallback background color for the console if none was provided and the current background color could not be determined from the console. The default is Black.

Type: ConsoleColor
Parameter Sets: (All)
Aliases:
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White

Required: False
Position: 2
Default value: Black
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None

Set-MailLogCredentials

SYNOPSIS

Sets the credentials for mail log sending.

SYNTAX

Set-MailLogCredentials [[-ConfigurationName] <String>] [-CredentialsFile] <String> [-InitCredentials] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

Sets the credentials for mail log sending.

PARAMETERS

-ConfigurationName

Name of the configuration to initialize with these settings. The default will be DefaultMailLog.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: $script:__Constant_DefaultGlobalMailLogName__
Accept pipeline input: False
Accept wildcard characters: False
-CredentialsFile

File to store mailing credentials in and read mailing credentials from (for access to the smtp server). Information will be stored in the XML file format. This parameter is mandatory.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InitCredentials

True/Present...The script will ask for the credentials to use for mail sending, store them in the credentials file and will then immediatly exit the script. Used to either set up credentials file for the first time, or change/renew the credentials in the credential file, without performing the actual task by the script. The -WhatIf switch cannot be used to make sure the script is not performing its task, because it will also prevent the script from saving the credentials to the credentials file. This switch is ignored if the CredentialsFile parameter is not provided.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None

NOTES

If the credentials file cannot be found, it will ask the user for the credentials and stores it in the credential file. For first use or to change the credentials, use the -InitCredentials switch, which will force storing new credentials and exits the script immediately after saving the credentials without executing the rest of the script. This is because the -WhatIf switch cannot be used to make sure the script is not performing its task, because it will also prevent the script from saving the credentials to the credentials file.

Set-TUNLogging_LocalMode

SYNOPSIS

Sets local mode for TUN Logging (for backwards compatibility)

SYNTAX

Set-TUNLogging_LocalMode [-Global] [<CommonParameters>]

PARAMETERS

-Global

True/Present...Will use new global mode (which is activated by default, only needed to reset to global mode) False/Absent...Will use local mode (call this function without switch to use local mode)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: False
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.

OUTPUTS

None

Start-Log

SYNOPSIS

Starts logging process for file log.

SYNTAX

Start-Log [[-LogPath] <String>] [[-LogName] <String>] [[-LogExtension] <String>]
 [[-ConfigurationName] <String>] [[-LogPreference_LogError] <Boolean>] [[-LogPreference_LogHost] <Boolean>]
 [[-LogPreference_LogOutput] <Boolean>] [[-LogPreference_LogVerbose] <Boolean>]
 [[-LogPreference_LogWarning] <Boolean>] [[-LogPreference_LogDebug] <Boolean>]
 [[-LogPreference_LogInformation] <Boolean>] [-NoFileLog] [-NoTextLog] [-NoTimestamp] [-UseComputerPrefix]
 [-UseScriptPrefix] [-UseDefaultName] [-NoDateTimeFormat] [-DeleteExisting] [-AsOutput] [-Force] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

Once this function has been called, the Write-ErrorLog etc. functions will add lines to a log file.

PARAMETERS

-LogPath

Path to the logfile directory. The default value is "." for the current working directory. Will interpret $(COMPUTERNAME) and $(SCRIPTNAME) as variables. If the path does not exist yet, it will try to create it.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: .\
Accept pipeline input: False
Accept wildcard characters: False
-LogName

Name of the logfile, will be interpreted as a datetime format if NoDateTimeFormat switch is not set. Therefore, certain (or optionally all) letters will have to be escaped with a backslash if they should not be interpreted as a datetime format character. If this parameter is not provided, it will behave as if -UseDefaultName switch is set. Will interpret $(COMPUTERNAME) and $(SCRIPTNAME) as variables. If a file with this name (or its resulting datetime format name) does not exist yet, it will try to create it. If a file with this name (or its resulting datetime format name) already exists, it will by default append the log messages at the end of the log file, or delete it if the switch DeleteExisting is present.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogExtension

Extension of the logfile The default value is "log" if not specified otherwise.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: Log
Accept pipeline input: False
Accept wildcard characters: False
-ConfigurationName

Name of the configuration to initialize with these settings. The default will be DefaultFileLog.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: $script:__Constant_DefaultGlobalFileLogName__
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_LogError

True....Will add error messages to the file log (no matter if they are displayed or logged in the mail log) False...Will not add error messages to the file log (no matter if they are displayed or logged in the mail log) null or not specified...The adding of error messages depends on the AsOutput switch. If the AsOutput switch is present, then error messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_LogHost

True....Will add host messages to the file log (no matter if they are displayed or logged in the mail log) False...Will not add host messages to the file log (no matter if they are displayed or logged in the mail log) null or not specified...The adding of host messages depends on the AsOutput switch. If the AsOutput switch is present, then host messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_LogOutput

True....Will add output messages to the file log (no matter if they are displayed or logged in the mail log) False...Will not add output messages to the file log (no matter if they are displayed or logged in the mail log) null or not specified...The adding of output messages depends on the AsOutput switch. If the AsOutput switch is present, then output messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_LogVerbose

True....Will add verbose messages to the file log (no matter if they are displayed or logged in the mail log) False...Will not add verbose messages to the file log (no matter if they are displayed or logged in the mail log) null or not specified...The adding of verbose messages depends on the AsOutput switch. If the AsOutput switch is present, then verbose messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_LogWarning

True....Will add warning messages to the file log (no matter if they are displayed or logged in the mail log) False...Will not add warning messages to the file log (no matter if they are displayed or logged in the mail log) null or not specified...The adding of warning messages depends on the AsOutput switch. If the AsOutput switch is present, then warning messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_LogDebug

True....Will add debug messages to the file log (no matter if they are displayed or logged in the mail log) False...Will not add debug messages to the file log (no matter if they are displayed or logged in the mail log) null or not specified...The adding of debug messages depends on the AsOutput switch. If the AsOutput switch is present, then debug messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_LogInformation

True....Will add information messages to the file log (no matter if they are displayed or logged in the mail log) False...Will not add information messages to the file log (no matter if they are displayed or logged in the mail log) null or not specified...The adding of information messages depends on the AsOutput switch. If the AsOutput switch is present, then information messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoFileLog

True/Present...Will not store the logs in a file, this switch is mutally exclusive with the NoTextLog switch (only one of those can be provided)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoTextLog

True/Present...Will not store the logs in text form, this switch is mutally exclusive with the NoFileLog switch (only one of those can be provided)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoTimestamp

True/Present...Will not automatically add a timestamp to the beginning of each line in the log file. If this switch is set, use the -AddTimestamp switch on individual log calls to add a timestamp if needed.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-UseComputerPrefix

True/Present...Will add the computer name in front of the log file name, followed by an underscore (will also be in front of the script name if UseScriptPrefix switch is set too)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-UseScriptPrefix

True/Present...Will add the script name in front of the log file name, followed by an underscore.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-UseDefaultName

True/Present...Will ignore LogName, UseScriptPrefix, UseComputerPrefix and NoDateTimeFormat and use the following name for the logfile: $(COMPUTERNAME)_$(SCRIPTNAME)_yyyy-MM-ddTHHmmss

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoDateTimeFormat

True/Present...Will not interprete LogName as a datetime format (and no letters will have to be escaped with backslashes)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-DeleteExisting

True/Present...Deletes an existing log file if it already exists. Otherwise new log messages will be appended at the end of the log file.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AsOutput

True/Present...For all message types for which no LogPreference was set (or for which the LogPreference is null) the message will only be added if it is displayed to the user (or would be displayed to the user if it is an automatic script) according to its environment variable. False/Absent...For all message types for which no LogPreference was set (or for which the LogPreference is null) the message will always be added regardless if it is displayed to the user (or would be displayed to the user if it is an automatic script) according to its environment variable.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will log regardless of -WhatIf switch of calling script False/Absent...Will only log if -WhatIf switch is not present in calling script

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None

Start-MailLog

SYNOPSIS

Starts logging process for mail log.

SYNTAX

Start-MailLog [[-ConfigurationName] <String>] [[-CredentialsFile] <String>]
 [[-LogPreference_MailError] <Boolean>] [[-LogPreference_MailHost] <Boolean>]
 [[-LogPreference_MailOutput] <Boolean>] [[-LogPreference_MailVerbose] <Boolean>]
 [[-LogPreference_MailWarning] <Boolean>] [[-LogPreference_MailDebug] <Boolean>]
 [[-LogPreference_MailInformation] <Boolean>] [-AddTimestamp] [-AsOutput] [-InitCredentials] [-Force] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

Once this function has been called, the Write-ErrorLog etc. functions will add lines to a mail text that can later on be sent by mail with the Send-Log command.

PARAMETERS

-ConfigurationName

Name of the configuration to initialize with these settings. The default will be DefaultMailLog.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: $script:__Constant_DefaultGlobalMailLogName__
Accept pipeline input: False
Accept wildcard characters: False
-CredentialsFile

File to store mailing credentials in and read mailing credentials from (for access to the smtp server). Information will be stored in the XML file format. If no path for a credentials file was provided, the credentials of the script execution will be used to connect to the smtp server.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_MailError

True....Will add error messages to the log mail text (no matter if they are displayed or logged in the file log) False...Will not add error messages to the log mail text (no matter if they are displayed or logged in the file log) null or not specified...The adding of error messages depends on the AsOutput switch. If the AsOutput switch is present, then error messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_MailHost

True....Will add host messages to the log mail text (no matter if they are displayed or logged in the file log) False...Will not add host messages to the log mail text (no matter if they are displayed or logged in the file log) null or not specified...The adding of host messages depends on the AsOutput switch. If the AsOutput switch is present, then host messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_MailOutput

True....Will add output messages to the log mail text (no matter if they are displayed or logged in the file log) False...Will not add output messages to the log mail text (no matter if they are displayed or logged in the file log) null or not specified...The adding of output messages depends on the AsOutput switch. If the AsOutput switch is present, then output messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_MailVerbose

True....Will add verbose messages to the log mail text (no matter if they are displayed or logged in the file log) False...Will not add verbose messages to the log mail text (no matter if they are displayed or logged in the file log) null or not specified...The adding of verbose messages depends on the AsOutput switch. If the AsOutput switch is present, then verbose messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_MailWarning

True....Will add warning messages to the log mail text (no matter if they are displayed or logged in the file log) False...Will not add warning messages to the log mail text (no matter if they are displayed or logged in the file log) null or not specified...The adding of warning messages depends on the AsOutput switch. If the AsOutput switch is present, then warning messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_MailDebug

True....Will add debug messages to the log mail text (no matter if they are displayed or logged in the file log) False...Will not add debug messages to the log mail text (no matter if they are displayed or logged in the file log) null or not specified...The adding of debug messages depends on the AsOutput switch. If the AsOutput switch is present, then debug messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogPreference_MailInformation

True....Will add information messages to the log mail text (no matter if they are displayed or logged in the file log) False...Will not add information messages to the log mail text (no matter if they are displayed or logged in the file log) null or not specified...The adding of information messages depends on the AsOutput switch. If the AsOutput switch is present, then information messages will only be added if they are displayed, if the AsOutput switch is absent, they will always be added.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp at the beginning of each line False/Absent...Will not add a timestamp at the beginning of each line

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AsOutput

True/Present...For all message types for which no LogPreference was set (or for which the LogPreference is null) the message will only be added if it is displayed to the user (or would be displayed to the user if it is an automatic script) according to its environment variable. False/Absent...For all message types for which no LogPreference was set (or for which the LogPreference is null) the message will always be added regardless if it is displayed to the user (or would be displayed to the user if it is an automatic script) according to its environment variable.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-InitCredentials

True/Present...The script will ask for the credentials to use for mail sending, store them in the credentials file and will then immediatly exit the script. Used to either set up credentials file for the first time, or change/renew the credentials in the credential file, without performing the actual task by the script. The -WhatIf switch cannot be used to make sure the script is not performing its task, because it will also prevent the script from saving the credentials to the credentials file. This switch is ignored if the CredentialsFile parameter is not provided.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will log regardless of -WhatIf switch of calling script False/Absent...Will only log if -WhatIf switch is not present in calling script

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None

NOTES

If the credentials file cannot be found, it will ask the user for the credentials and stores it in the credential file. For first use or to change the credentials, use the -InitCredentials switch, which will force storing new credentials and exits the script immediately after saving the credentials without executing the rest of the script. This is because the -WhatIf switch cannot be used to make sure the script is not performing its task, because it will also prevent the script from saving the credentials to the credentials file.

Stop-Log

SYNOPSIS

Stops logging process for log file.

SYNTAX

Stop-Log [[-ConfigurationName] <String[]>] [-KeepLoggingFile] [-KeepLoggingText] [-WhatIf] [-Confirm]
 [<CommonParameters>]

PARAMETERS

-ConfigurationName

One or more names of the configurations to write to. Default is $null and all configurations will be stopped.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-KeepLoggingFile

True/Present...Will not stop file logging False/Absent...Will stop file logging

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-KeepLoggingText

True/Present...Will not stop text logging False/Absent...Will stop text logging

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None

NOTES

Once this function has been called, the Write-ErrorLog etc. functions will not add any more lines to the file log.

Write-DebugLog

SYNOPSIS

Emulates Write-Debug but also logs the message in the file and mail log (if applicable)

SYNTAX

Write-DebugLog [-Message] <Object> [[-ConfigurationName] <String[]>] [-NoOut] [-NoLog] [-NoMail]
 [-AddTimestamp] [-Force] [-ForceMail] [-WhatIf] [-Confirm] [<CommonParameters>]

PARAMETERS

-Message

The debug message

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to which to write to. Default is $null and the message will be written to all running log configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoOut

True/Present...Will not print the debug message to the console

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLog

True/Present...Will not log the debug message to the log file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoMail

True/Present...Will not add the debug message to the mail log

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp to each line of the message string, regardless if the -NoTimestamp flag in Start-Log was set False/Absent...Will only add a timestamp to each line of the message string if the -NoTimestamp flag in Start-Log was not set (which is the default behaviour)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will write the message to the log file, regardless of the rules for debug message logging (as set on Start-Log call) False/Absent...Will only write the message to the log file if debug message logging rules apply (as set on Start-Log call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceMail

True/Present...Will write the message to the mail log, regardless of the rules for debug message logging (as set on Start-MailLog call) False/Absent...Will only write the message to the mail log if debug message logging rules apply (as set on Start-MailLog call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None (Prints debug message)

NOTES

Can recieve the message through pipe

Write-ErrorLog

SYNOPSIS

Emulates Write-Error but also logs the error in the file and mail log (if applicable)

SYNTAX

Write-ErrorLog [[-Message] <String>] [[-Category] <ErrorCategory>] [[-Err] <ErrorRecord>]
 [[-ConfigurationName] <String[]>] [-NoOut] [-NoLog] [-NoMail] [-AddTimestamp] [-NoErrorDetails] [-Force]
 [-ForceMail] [-WhatIf] [-Confirm] [<CommonParameters>]

EXAMPLES

EXAMPLE 1
.\Update-Month.ps1 -inputpath C:\Data\January.csv
EXAMPLE 2
.\Update-Month.ps1 -inputpath C:\Data\January.csv -outputPath C:\Reports\2009\January.csv

PARAMETERS

-Message

Additional error message

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Category

Error category of type [System.Management.Automation.ErrorCategory] (default is NotSpecified)

Type: ErrorCategory
Parameter Sets: (All)
Aliases:
Accepted values: NotSpecified, OpenError, CloseError, DeviceError, DeadlockDetected, InvalidArgument, InvalidData, InvalidOperation, InvalidResult, InvalidType, MetadataError, NotImplemented, NotInstalled, ObjectNotFound, OperationStopped, OperationTimeout, SyntaxError, ParserError, PermissionDenied, ResourceBusy, ResourceExists, ResourceUnavailable, ReadError, WriteError, FromStdErr, SecurityError, ProtocolError, ConnectionError, AuthenticationError, LimitsExceeded, QuotaExceeded, NotEnabled

Required: False
Position: 2
Default value: NotSpecified
Accept pipeline input: False
Accept wildcard characters: False
-Err

Error object (as recieved by catch block), can also be recieved through pipe

Type: ErrorRecord
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to which to write to. Default is $null and the message will be written to all running log configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoOut

True/Present...Will not print the error message to the console

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLog

True/Present...Will not log the error message to the log file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoMail

True/Present...Will not add the error message to the mail log

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp to each line of the message string, regardless if the -NoTimestamp flag in Start-Log was set False/Absent...Will only add a timestamp to each line of the message string if the -NoTimestamp flag in Start-Log was not set (which is the default behaviour)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoErrorDetails

True/Present...Will not add details of the original error object to the error message False/Absent...Will add details of the original error object to the error message

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will write the message to the log file, regardless of the rules for error message logging (as set on Start-Log call) False/Absent...Will only write the message to the log file if error message logging rules apply (as set on Start-Log call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceMail

True/Present...Will write the message to the mail log, regardless of the rules for error message logging (as set on Start-MailLog call) False/Absent...Will only write the message to the mail log if error message logging rules apply (as set on Start-MailLog call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None (Prints error message)

NOTES

Can recieve error object through pipe, example call in catch block: catch { $_ | Write-ErrorLog "Example error message" }

Write-HostLog

SYNOPSIS

Emulates Write-Host but also logs the message in the file and mail log (if applicable)

SYNTAX

Write-HostLog [-Message] <Object> [[-ConfigurationName] <String[]>] [-NoNewline]
 [-ForegroundColor <ConsoleColor>] [-BackgroundColor <ConsoleColor>] [-NoOut] [-NoLog] [-NoMail]
 [-AddTimestamp] [-Force] [-ForceMail] [-WhatIf] [-Confirm] [<CommonParameters>]

PARAMETERS

-Message

The host message

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to which to write to. Default is $null and the message will be written to all running log configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoNewline

Same as NoNewline switch in Write-Host cmdlet

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForegroundColor

Same as ForegroundColor parameter in Write-Host cmdlet (only applies to message output to console, not logging)

Type: ConsoleColor
Parameter Sets: (All)
Aliases:
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White

Required: False
Position: Named
Default value: (Get-ConsoleForegroundColor)
Accept pipeline input: False
Accept wildcard characters: False
-BackgroundColor

Same as BackgroundColor parameter in Write-Host cmdlet (only applies to message output to console, not logging)

Type: ConsoleColor
Parameter Sets: (All)
Aliases:
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White

Required: False
Position: Named
Default value: (Get-ConsoleBackgroundColor)
Accept pipeline input: False
Accept wildcard characters: False
-NoOut

True/Present...Will not print the host message to the console

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLog

True/Present...Will not log the host message to the log file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoMail

True/Present...Will not add the host message to the mail log

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp to each line of the message string, regardless if the -NoTimestamp flag in Start-Log was set False/Absent...Will only add a timestamp to each line of the message string if the -NoTimestamp flag in Start-Log was not set (which is the default behaviour)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will write the message to the log file, regardless of the rules for host message logging (as set on Start-Log call) False/Absent...Will only write the message to the log file if host message logging rules apply (as set on Start-Log call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceMail

True/Present...Will write the message to the mail log, regardless of the rules for host message logging (as set on Start-MailLog call) False/Absent...Will only write the message to the mail log if host message logging rules apply (as set on Start-MailLog call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None (Prints host message)

NOTES

Can recieve the message through pipe

Write-InformationLog

SYNOPSIS

Emulates Write-Information but also logs the message in the file and mail log (if applicable)

SYNTAX

Write-InformationLog [-Message] <Object> [[-ConfigurationName] <String[]>] [-NoOut] [-NoLog] [-NoMail]
 [-AddTimestamp] [-Force] [-ForceMail] [-WhatIf] [-Confirm] [<CommonParameters>]

PARAMETERS

-Message

The information message

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to which to write to. Default is $null and the message will be written to all running log configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoOut

True/Present...Will not print the information message to the console

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLog

True/Present...Will not log the information message to the log file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoMail

True/Present...Will not add the information message to the mail log

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp to each line of the message string, regardless if the -NoTimestamp flag in Start-Log was set False/Absent...Will only add a timestamp to each line of the message string if the -NoTimestamp flag in Start-Log was not set (which is the default behaviour)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will write the message to the log file, regardless of the rules for information message logging (as set on Start-Log call) False/Absent...Will only write the message to the log file if information message logging rules apply (as set on Start-Log call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceMail

True/Present...Will write the message to the mail log, regardless of the rules for information message logging (as set on Start-MailLog call) False/Absent...Will only write the message to the mail log if information message logging rules apply (as set on Start-MailLog call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None (Prints information message)

NOTES

Can recieve the message through pipe

Write-OutputLog

SYNOPSIS

Emulates Write-Output but also logs the message in the file and mail log (if applicable)

SYNTAX

Write-OutputLog [-Message] <Object> [[-ConfigurationName] <String[]>] [-NoOut] [-NoLog] [-NoMail]
 [-AddTimestamp] [-Force] [-ForceMail] [-WhatIf] [-Confirm] [<CommonParameters>]

PARAMETERS

-Message

The output message

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to which to write to. Default is $null and the message will be written to all running log configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoOut

True/Present...Will not print the output message to the console

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLog

True/Present...Will not log the output message to the log file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoMail

True/Present...Will not add the output message to the mail log

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp to each line of the message string, regardless if the -NoTimestamp flag in Start-Log was set False/Absent...Will only add a timestamp to each line of the message string if the -NoTimestamp flag in Start-Log was not set (which is the default behaviour)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will write the message to the log file, regardless of the rules for output message logging (as set on Start-Log call) False/Absent...Will only write the message to the log file if output message logging rules apply (as set on Start-Log call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceMail

True/Present...Will write the message to the mail log, regardless of the rules for output message logging (as set on Start-MailLog call) False/Absent...Will only write the message to the mail log if output message logging rules apply (as set on Start-MailLog call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None (Prints output message)

NOTES

Can recieve the message through pipe

Write-VerboseLog

SYNOPSIS

Emulates Write-Verbose but also logs the message in the file and mail log (if applicable)

SYNTAX

Write-VerboseLog [-Message] <Object> [[-ConfigurationName] <String[]>] [-NoOut] [-NoLog] [-NoMail]
 [-AddTimestamp] [-Force] [-ForceMail] [-WhatIf] [-Confirm] [<CommonParameters>]

PARAMETERS

-Message

The verbose message

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to which to write to. Default is $null and the message will be written to all running log configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoOut

True/Present...Will not print the verbose message to the console

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLog

True/Present...Will not log the verbose message to the log file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoMail

True/Present...Will not add the verbose message to the mail log

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp to each line of the message string, regardless if the -NoTimestamp flag in Start-Log was set False/Absent...Will only add a timestamp to each line of the message string if the -NoTimestamp flag in Start-Log was not set (which is the default behaviour)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will write the message to the log file, regardless of the rules for verbose message logging (as set on Start-Log call) False/Absent...Will only write the message to the log file if verbose message logging rules apply (as set on Start-Log call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceMail

True/Present...Will write the message to the mail log, regardless of the rules for verbose message logging (as set on Start-MailLog call) False/Absent...Will only write the message to the mail log if verbose message logging rules apply (as set on Start-MailLog call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None (Prints verbose message)

NOTES

Can recieve the message through pipe

Write-WarningLog

SYNOPSIS

Emulates Write-Warning but also logs the message in the file and mail log (if applicable)

SYNTAX

Write-WarningLog [-Message] <Object> [[-ConfigurationName] <String[]>] [-NoOut] [-NoLog] [-NoMail]
 [-AddTimestamp] [-Force] [-ForceMail] [-WhatIf] [-Confirm] [<CommonParameters>]

PARAMETERS

-Message

The warning message

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ConfigurationName

One or more names of the configurations to which to write to. Default is $null and the message will be written to all running log configurations.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoOut

True/Present...Will not print the warning message to the console

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLog

True/Present...Will not log the warning message to the log file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoMail

True/Present...Will not add the warning message to the mail log

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AddTimestamp

True/Present...Will add a timestamp to each line of the message string, regardless if the -NoTimestamp flag in Start-Log was set False/Absent...Will only add a timestamp to each line of the message string if the -NoTimestamp flag in Start-Log was not set (which is the default behaviour)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force

True/Present...Will write the message to the log file, regardless of the rules for warning message logging (as set on Start-Log call) False/Absent...Will only write the message to the log file if warning message logging rules apply (as set on Start-Log call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceMail

True/Present...Will write the message to the mail log, regardless of the rules for warning message logging (as set on Start-MailLog call) False/Absent...Will only write the message to the mail log if warning message logging rules apply (as set on Start-MailLog call)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

OUTPUTS

None (Prints warning message)

NOTES

Can recieve the message through pipe

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published