-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathImport-WVDSoftware.ps1
57 lines (45 loc) · 1.71 KB
/
Import-WVDSoftware.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
<#
.SYNOPSIS
Upload Scripts and Executable files needed to customize WVD VMs to the created Storage Accounts blob containers.
.DESCRIPTION
This cmdlet uploads files specifiied in the contentToUpload-sourcePath parameter to the blob specified in the contentToUpload-targetBlob parameter to the specified Azure Storage Account.
.PARAMETER Url
Specifies the URI from which to download data.
.PARAMETER FileName
Specifies the name of the local file that is to receive the data.
.PARAMETER Confirm
Will promt user to confirm the action to create invasible commands
.PARAMETER WhatIf
Dry run of the script
.EXAMPLE
Import-WVDSoftware -Url "https://aka.ms/fslogix_download" -FileName "FSLogixApp.zip"
Downloads file from the specified Uri and save it to the specified filepath
#>
function Import-WVDSoftware {
[CmdletBinding(SupportsShouldProcess = $True)]
param(
[Parameter(
Mandatory = $true,
HelpMessage = "Specifies the URI from which to download data."
)]
[string] $Url,
[Parameter(
Mandatory = $true,
HelpMessage = "Specifies the name of the local file that is to receive the data."
)]
[string] $FileName
)
Write-Verbose "Getting current time."
$start_time = Get-Date
try {
Write-Verbose "Starting download...."
if ($PSCmdlet.ShouldProcess("Required executable files from $url to $filename", "Import")) {
(New-Object System.Net.WebClient).DownloadFile($Url, $FileName)
}
Write-Verbose "Download completed."
Write-Verbose "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
}
catch {
Write-Error "Download FAILED: $_"
}
}