forked from DTC-Inc/msp-script-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript-template-powershell.ps1
More file actions
50 lines (36 loc) · 1.52 KB
/
Copy pathscript-template-powershell.ps1
File metadata and controls
50 lines (36 loc) · 1.52 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
## PLEASE COMMENT YOUR VARIALBES DIRECTLY BELOW HERE IF YOU'RE RUNNING FROM A RMM
## THIS IS HOW WE EASILY LET PEOPLE KNOW WHAT VARIABLES NEED SET IN THE RMM
# Getting input from user if not running from RMM else set variables from RMM.
$ScriptLogName = "EnterLogNameHere.log"
if ($RMM -ne 1) {
$ValidInput = 0
# Checking for valid input.
while ($ValidInput -ne 1) {
# Ask for input here. This is the interactive area for getting variable information.
# Remember to make ValidInput = 1 whenever correct input is given.
$Description = Read-Host "Please enter the ticket # and, or your initials. Its used as the Description for the job"
if ($Description) {
$ValidInput = 1
} else {
Write-Host "Invalid input. Please try again."
}
}
$LogPath = "$ENV:WINDIR\logs\$ScriptLogName"
} else {
# Store the logs in the RMMScriptPath
if ($null -eq $RMMScriptPath) {
$LogPath = "$RMMScriptPath\logs\$ScriptLogName"
} else {
$LogPath = "$ENV:WINDIR\logs\$ScriptLogName"
}
if ($null -eq $Description) {
Write-Host "Description is null. This was most likely run automatically from the RMM and no information was passed."
$Description = "No Description"
}
}
# Start the script logic here. This is the part that actually gets done what you need done.
Start-Transcript -Path $LogPath
Write-Host "Description: $Description"
Write-Host "Log path: $LogPath"
Write-Host "RMM: $RMM"
Stop-Transcript