forked from DeploymentResearch/DRFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplicationInstallWrapper.ps1
54 lines (43 loc) · 1.84 KB
/
ApplicationInstallWrapper.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
# Initialize
$ScriptDir = split-path -parent $MyInvocation.MyCommand.Path
$ScriptName = split-path -leaf $MyInvocation.MyCommand.Path
$Lang = (Get-Culture).Name
$Architecture = $env:PROCESSOR_ARCHITECTURE
$Logpath = "C:\Windows\Temp"
$LogFile = $Logpath + "\" + "$ScriptName.txt"
# Start logging
Start-transcript -path $LogFile
#Output base info
Write-Output ""
Write-Output "$ScriptName - ScriptDir: $ScriptDir"
Write-Output "$ScriptName - ScriptName: $ScriptName"
Write-Output "$ScriptName - Current Culture: $Lang"
Write-Output "$ScriptName - Architecture: $Architecture"
Write-Output "$ScriptName - Log: $LogFile"
# Copy PreReq Files
If (!(Test-Path "C:\Windows\System32\EMC\QlikView")) {New-Item -Path "C:\Windows\System32\EMC\QlikView" -ItemType Directory}
Copy-Item -Path "$ScriptDir\Settings.ini" -Destination "C:\Windows\System32\EMC\QlikView\"
Copy-Item -Path "$ScriptDir\QlikViewAppDataCopy.cmd" -Destination "C:\Windows\System32\EMC\QlikView\"
# Installing
$SetupName = "QlikView Plugin"
$SetupFile = "msiexec"
$SetupSwitches = "/passive /i $ScriptDir\QvPluginSetup-v11.msi ALLUSERS=1 /quiet"
Write-Output "Starting install of $SetupName"
Write-Output "Command line to start is: $SetupFile $SetupSwitches"
Start-Process -FilePath $SetupFile -ArgumentList $SetupSwitches -NoNewWindow -Wait
Write-Output "Finished installing $SetupName"
# Post Installation tasks
## Default Profile Location
$defaultProfileHive = "HKLM\DefaultProfile"
$defaultProfileLocation = "C:\Users\Default\ntuser.dat"
$regFile = "$ScriptDir\HKCU_QvPluginSetup_DefaultProfile.reg"
## Load Default Profile Registry Hive
reg load $defaultProfileHive $defaultProfileLocation
## Call .reg file from local directory
regedit /s $regFile
## Release handles on Registry Hive
[gc]::collect()
## Unload Default Profile Registry Hive
reg unload $defaultProfileHive
# Stop logging
Stop-Transcript