PowerShell Template script with detailed logging functions along with color output messages to console
Script: # # PowerShell Script #=============================================================================== # Objective: # ———- # This is a basic template script that comes with default script sections along # with debug options set. # # # $Header: $ #=============================================================================== # Process-Arguments #=============================================================================== param ( [string]$LOG, [bool]$DEBUG ) #=============================================================================== # Include Modules #=============================================================================== #=============================================================================== # Global Variables Declaration #=============================================================================== $LogPath = $env:TEMP $ScriptName = "Template-Script.log" $LogFile = $LogPath + ” + $ScriptName #=============================================================================== # Function Prototypes Section #=============================================================================== function MyLog { param ( [string]$msg, [int]$flag ) $date = get-date -format MM:dd:yyyy-HH:mm:ss $str = "$date " switch […]
Read more