-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInstall.ps1
59 lines (46 loc) · 1.63 KB
/
Install.ps1
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
#requires -Version 5.0
<#
.DESCRIPTION
Script to install/update MyVeeamReport
.NOTES
Author: Bernhard Roth
Last Updated: 2 Februar 2023
Version: 1.1
#>
# Customize to your requirements...
$Script = "C:\Temp\MyVeeamReport.ps1"
$Config = "C:\Temp\MyVeeamReport_config.ps1"
$Schedule = "C:\Temp\Schedule.ps1"
$URL_Script = "https://raw.githubusercontent.com/marcohorstmann/MyVeeamReport/main/MyVeeamReport.ps1"
$URL_Config = "https://raw.githubusercontent.com/marcohorstmann/MyVeeamReport/main/MyVeeamReport_config.ps1"
$URL_Schedule = "https://raw.githubusercontent.com/marcohorstmann/MyVeeamReport/main/Schedule.ps1"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# download latest version of script
Write-Host "Downloading latest version of script..."
try {
Invoke-WebRequest -outfile $Script -uri $URL_Script
Write-Host "The file [$Script] has been created."
} catch {
throw $_.Exception.Message
}
# if the config file does not exist, create it.
if (-not(Test-Path -Path $Config -PathType Leaf)) {
Write-Host "Downloading latest version of configuration file..."
try {
Invoke-WebRequest -outfile $Config -uri $URL_Config
Write-Host "The file [$Config] has been created."
} catch {
throw $_.Exception.Message
}
}
# download schedule script
Write-Host "Downloading latest version of schedule script..."
try {
Invoke-WebRequest -outfile $Schedule -uri $URL_Schedule
Write-Host "Executing script..."
Invoke-Expression -Command $Schedule
Remove-Item $Schedule
Write-Host "Scheduler set"
} catch {
throw $_.Exception.Message
}