-
Notifications
You must be signed in to change notification settings - Fork 0
/
RemoteAppInstall.ps1
38 lines (30 loc) · 1.71 KB
/
RemoteAppInstall.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
#########################################################################################################################################
### Registry key checks (make sure to use single quotes around the whole reg key string) ###
### Acrobat Pro DC: HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{AC76BA86-1033-FFFF-7760-0C0F074E4100} ###
#########################################################################################################################################
### Set the computerName variable
$computerName = "computer name here"
### Enters PowerShell Remote Session
Enter-PSSession $computerName
### Sets variables
$programFolderName = "program folder name here"
$regKey = "set reg key here"
$exeName = "executable name here"
### Checks to see if C:\temp exists, if it does not exist, create it.
$tempFolder = "C:\temp"
If (-not (Test-Path $tempFolder)) {
# Folder does not exist, create it
New-Item -Path $tempFolder -ItemType Directory
Write-Host "New Folder Created at '$tempFolder', carrying on..." -f Green
}
Else {
Write-Host "Folder '$tempFolder' already exists, carrying on..." -f Orange
}
### Copies the program from a remote or local share
### Use a \* and -Recurse for a full directory
Copy-Item -Path "\\path\here\my\boy\$programFolderName\*" -Destination "$tempFolder" -Recurse
### Starts the installation and waits for it to finish
Start-Process -FilePath "$tempFolder\$programFolderName\$exeName.exe" -Wait
### Checks registry key for correct version
Get-ItemProperty -Path '$regKey' | Select-Object -ExpandProperty DisplayVersion
### Checks folder for correct version.. coming soon?