Skip to content

JSChronicles/General

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

General

Psscriptanalyzer Pester Test


Introduction

A repository of possibly helpful scripts

Usage

Most of my scripts utilize a logger so that way you can review the logs at some point on your own time.If you don't want that then either comment or remove all lines that start with $logger.

Basically we can check if the type is currently initated and if not then we can do it via this small piece of code

# This will grab the currently running script name and name the log file as such
if (!("PSLogger" -as [type])) {
    $callingSCript = ($MyInvocation.MyCommand.Name) -split ('.ps1')
    ."\\UNC\Path\Here\Logging.ps1"
    $logger = [PSLogger]::new($logPath, $callingScript)
}

# This will use "ScriptNameHere" to name the log file
if (!("PSLogger" -as [type])) {
    ."\\UNC\Path\Here\Logging.ps1"
    $logger = [PSLogger]::new($logPath, "ScriptNameHere")
}

About

A repository full of possibly helpful scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors