Skip to content

Instantly share code, notes, and snippets.

@damokles2k
Forked from 9to5IT/Script_Template.ps1
Created October 28, 2016 21:57
Show Gist options
  • Save damokles2k/ada5fb65d3cd914829a151ce01111c19 to your computer and use it in GitHub Desktop.
Save damokles2k/ada5fb65d3cd914829a151ce01111c19 to your computer and use it in GitHub Desktop.

Revisions

  1. @9to5IT 9to5IT revised this gist Jan 13, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Script_Template.ps1
    Original file line number Diff line number Diff line change
    @@ -41,7 +41,7 @@ $sScriptVersion = "1.0"
    #Log File Info
    $sLogPath = "C:\Windows\Temp"
    $sLogName = "<script_name>.log"
    $sLogFile = $sLogPath + "\" + $sLogName
    $sLogFile = Join-Path -Path $sLogPath -ChildPath $sLogName

    #-----------------------------------------------------------[Functions]------------------------------------------------------------

  2. @9to5IT 9to5IT created this gist Mar 18, 2014.
    82 changes: 82 additions & 0 deletions Script_Template.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,82 @@
    #requires -version 2
    <#
    .SYNOPSIS
    <Overview of script>
    .DESCRIPTION
    <Brief description of script>
    .PARAMETER <Parameter_Name>
    <Brief description of parameter input required. Repeat this attribute if required>
    .INPUTS
    <Inputs if any, otherwise state None>
    .OUTPUTS
    <Outputs if any, otherwise state None - example: Log file stored in C:\Windows\Temp\<name>.log>
    .NOTES
    Version: 1.0
    Author: <Name>
    Creation Date: <Date>
    Purpose/Change: Initial script development
    .EXAMPLE
    <Example goes here. Repeat this attribute for more than one example>
    #>

    #---------------------------------------------------------[Initialisations]--------------------------------------------------------

    #Set Error Action to Silently Continue
    $ErrorActionPreference = "SilentlyContinue"

    #Dot Source required Function Libraries
    . "C:\Scripts\Functions\Logging_Functions.ps1"

    #----------------------------------------------------------[Declarations]----------------------------------------------------------

    #Script Version
    $sScriptVersion = "1.0"

    #Log File Info
    $sLogPath = "C:\Windows\Temp"
    $sLogName = "<script_name>.log"
    $sLogFile = $sLogPath + "\" + $sLogName

    #-----------------------------------------------------------[Functions]------------------------------------------------------------

    <#
    Function <FunctionName>{
    Param()
    Begin{
    Log-Write -LogPath $sLogFile -LineValue "<description of what is going on>..."
    }
    Process{
    Try{
    <code goes here>
    }
    Catch{
    Log-Error -LogPath $sLogFile -ErrorDesc $_.Exception -ExitGracefully $True
    Break
    }
    }
    End{
    If($?){
    Log-Write -LogPath $sLogFile -LineValue "Completed Successfully."
    Log-Write -LogPath $sLogFile -LineValue " "
    }
    }
    }
    #>

    #-----------------------------------------------------------[Execution]------------------------------------------------------------

    #Log-Start -LogPath $sLogPath -LogName $sLogName -ScriptVersion $sScriptVersion
    #Script Execution goes here
    #Log-Finish -LogPath $sLogFile