-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript Example
More file actions
66 lines (59 loc) · 1.88 KB
/
Script Example
File metadata and controls
66 lines (59 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<#
.SYNOPSIS
[One-line summary of the script’s purpose]
.DESCRIPTION
[Detailed description of what the script does, steps it performs, and any special notes.
Include environment or system-specific context if needed.]
.PARAMETER [ParameterName]
[Description of parameters if your script uses any]
.EXAMPLE
[Example of how to run the script]
.NOTES
Filename: [ScriptName].ps1
Author: Keensy
Version: 1.0
Date: [Creation Date]
Environment: [Optional: DEV / PROD / VM / etc.]
#>
#---------------------------------------------------------[Initialisations]--------------------------------------------------------
<#
Initialise variables, paths, log locations, module imports, or any constants used in the script.
#>
# Example:
# $LogPath = "C:\Temp\ScriptLog.txt"
# Import-Module ActiveDirectory
#---------------------------------------------------------[Functions]-----------------------------------------------------------
<#
Define all functions here with proper comment-based help for each function.
Each function should have its own .SYNOPSIS, .DESCRIPTION, .PARAMETER, .EXAMPLE, .NOTES blocks.
#>
# Example:
# function Get-FileName {
# [CmdletBinding()]
# param (
# [string]$InitialDirectory = "C:\"
# )
# <# Function logic here #>
# }
#---------------------------------------------------------[Execution]-----------------------------------------------------------
<#
Main script execution logic.
- Import CSV or input files
- Loop through objects
- Call functions
- Handle errors with try/catch
- Write logs or output results
#>
# Example:
# try {
# $Data = Import-Csv -Path $CsvPath
# foreach ($Item in $Data) {
# # Do something
# }
# }
# catch {
# Write-Host "Error: $($_.Exception.Message)"
# }
# finally {
# # Clean-up code or stop logging
# }