Skip to content

Instantly share code, notes, and snippets.

@chris2fer
Created January 20, 2015 05:35
Show Gist options
  • Save chris2fer/9238565548143e0d9b65 to your computer and use it in GitHub Desktop.
Save chris2fer/9238565548143e0d9b65 to your computer and use it in GitHub Desktop.

Revisions

  1. chris2fer created this gist Jan 20, 2015.
    7 changes: 7 additions & 0 deletions PowerShellLogger
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    $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
    }