Powershell template: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Basic template for use when creating a script: | Basic template for use when creating a script: | ||
<pre> | |||
<# | |||
.SYNOPSIS | |||
.DESCRIPTION | |||
.EXAMPLE | |||
.OUTPUTS | |||
.NOTES | |||
#> | |||
# SET DATE FORMAT | |||
$DateTime = $(get-date -f yyyy-MM-dd_HH-mm-ss) | |||
# START TRANSCRIPT LOGGING | |||
Start-Transcript -Path "log_$DateTime.txt" -Append | |||
Write-Host "Script stuff here" | |||
# STOP TRANSCRIPT LOGGING | |||
Stop-Transcript | |||
</pre> | |||
[[Category:PowerShell]] | [[Category:PowerShell]] |
Latest revision as of 11:49, 5 April 2024
Basic template for use when creating a script:
<# .SYNOPSIS .DESCRIPTION .EXAMPLE .OUTPUTS .NOTES #> # SET DATE FORMAT $DateTime = $(get-date -f yyyy-MM-dd_HH-mm-ss) # START TRANSCRIPT LOGGING Start-Transcript -Path "log_$DateTime.txt" -Append Write-Host "Script stuff here" # STOP TRANSCRIPT LOGGING Stop-Transcript