-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellAppInstallWIthSecureVariable
More file actions
32 lines (32 loc) · 1.75 KB
/
Copy pathShellAppInstallWIthSecureVariable
File metadata and controls
32 lines (32 loc) · 1.75 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
# define <securevariablename>, note the securevariablename you define in Nerdio needs to be set on line 20 AFTER it has been set in Settings -> Environment -> Nerdio -> Secure Variables -> Add Secure Variable
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $SecureVar_<securevariablename>
)
# Define your storage path (storage account and share names)
$storageAccount = "<storageAccountName>"
$shareName = "<ShareName>"
$uncPath = "\\$storageAccount.file.core.windows.net\$shareName"
# $baseSourcePath will be the name of the folder on the share that contains your install source(s)
$baseSourcePath = "$uncPath\Adobe Acrobat Standard"
#Define Base Destination Path and create folder if it does not exist
$baseDestinationPath = "C:\Packages\Installers\AdobeAcrobatStandard"
if (-Not (Test-Path $baseDestinationPath)) {
New-Item -Path $baseDestinationPath -ItemType Directory
Write-Output "Created destination directory at $baseDestinationPath"
}
# Add Azure Files credentials using cmdkey
$cmd = "/add:$storageAccount.file.core.windows.net /user:localhost\$storageAccount /pass:$SecureVar_<securevariablename>"
cmd.exe /C "cmdkey $cmd"
# Proceed to copy files from source share
Copy-Item -Path "$baseSourcePath\*" -Destination $baseDestinationPath -Recurse -Force
# Run installer from local folder
$exePath = "$baseDestinationPath\24.005.20320\setup.exe"
$installCommand = "& $exePath"
# Note the wait command is necessary to prevent clean up from running before install completes
Start-Process -FilePath $exePath -Wait
# Clean up cached credentials and install sources
cmd.exe /C "cmdkey /delete:$storageAccount.file.core.windows.net"
Get-ChildItem "$baseDestinationPath" -Recurse | Remove-Item -Force -Recurse
Remove-Item -Path $baseDestinationPath -Force