![]() Write -Host "$(Utility.Time-Stamp): The hosts file already contains the entry: $NewHostEntry. ![]() If((gc $HostsLocation) -contains $NewHostEntry) $NewHostEntry = "`t$IPAddress`t$HostName" $HostsLocation = "$env:windir\System32\drivers\etc\hosts" Throw "Failed to create log entry in: $Path. Writes logging information to screen and log file simultaneously. The encoding type to be used with the Out-File cmdlet. The ID to appear as the event ID attribute for the system event log entry. This is ignored unless 'EventLogName' is specified. The name to appear as the source attribute for the system event log entry. The number of spaces to indent the line in the log file.Įxisting log file is deleted when this is specified. Ignored when switch 'NoConsoleOut' is specified. Specifies what color the text should be be displayed on the console. Specifies to not display the message to the console. PS C:\> Utility.Write-Log -Message "Oops, not so good!" -LevelĮrror -EventID 3 -Indent 2 -EventLogName 'Application' -EventSource "My Script" Utility.Write-Log -Message "It's all good!" -PathĬ:\MyLog.log -Clobber -EventLogName 'Application'
0 Comments
Leave a Reply. |