Skip to content

Instantly share code, notes, and snippets.

@joconsol
Forked from chris2fer/PowerShellLogger
Last active August 29, 2015 14:13
Show Gist options
  • Save joconsol/a08b789743ad2d73e992 to your computer and use it in GitHub Desktop.
Save joconsol/a08b789743ad2d73e992 to your computer and use it in GitHub Desktop.
$logfile = "C:\admin\LOGS\CW-Monitoring-Install_log_$(get-date -format 'yyyyMMdd_hhmmsstt').txt"
function log($string, $color)
{
if ($Color -eq $null) { $color = "gray" }
write-host ($string + ' ' + $(get-date -format 'hhmmsstt')) -foregroundcolor $color
($string + ' ' + $(get-date -format 'hhmmsstt')) | out-file -Filepath $logfile -append
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment