-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-TestingFrameWork.ps1
64 lines (61 loc) · 2.95 KB
/
install-TestingFrameWork.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
60
61
62
63
64
$fromfile1 = "http://search.maven.org/remotecontent?filepath=org/python/jython-installer/2.5.3/jython-installer-2.5.3.jar"
$fromfile2 = "https://bootstrap.pypa.io/get-pip.py"
$fromfile3 = "https://launchpad.net/sikuli/sikulix/x1.0-rc3/+download/Sikuli-X-1.0rc3%20%28r905%29-win32.exe"
$fromfile4= "http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe"
$tofile1 = "C:\tmp\jython-installer-2.5.3.jar"
$tofile2 = "C:\tmp\get-pip.py"
$tofile3 = "C:\tmp\Sikuli-X-1.0rc3 (r905)-win32.exe"
$tofile4 = "C:\tmp\pscp.exe"
Write-Host -Object "downloading $fromfile1";
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($fromfile1, $tofile1)
$installfile="C:\tmp\jython-installer-2.5.3.jar"
$installfile2="C:\tmp\get-pip.py"
$installfile3="'C:\tools\python2\Scripts\pip.exe' install robotframework"
$installfile4="C:\tmp\Sikuli-X-1.0.3-win32.msi"
$logfile="C:\tmp\Sikulilog.txt"
Write-Host -Object "attempt install of $installfile";
& 'C:\Program Files\Java\jre7\bin\java.exe' -jar $installfile -s -d 'C:\Program Files (x86)\jython'
Write-Host -Object "downloading $fromfile2";
$webclient.DownloadFile($fromfile2, $tofile2)
Write-Host -Object "attempt install of $installfile2";
& python $installfile2
Write-Host -Object "attempt install of $installfile3";
& 'C:\tools\python2\Scripts\pip.exe' install robotframework
Write-Host -Object "downloading $fromfile3";
$webclient.DownloadFile($fromfile3, $tofile3)
Write-Host -Object "Extracting $tofile3";
& 'C:\tmp\Sikuli-X-1.0rc3 (r905)-win32.exe' /quiet /extract
$msiexe = "C:\Windows\System32\msiexec.exe"
$installerProcessname="msiexec"
$username="vagrant"
$i = 0
While ($i -le 0)
{
$processes=Get-WmiObject win32_process | Select-Object Name,@{n='Owner';e={$_.GetOwner().User}} | sort nam
If (($processes -match $installerProcessname ) -and ($processes -match $username))
{
Write-Host -Object " waiting 2 minutes for installs to finish";
$i = 0
Start-Sleep -s 120
}
else
{
Write-Host -Object "install process finished";
$i = 1
}
}
Write-Host -Object "Attempting instal of $installfile4";
& 'C:\Windows\System32\msiexec.exe' /qb /l* $logfile /i $installfile4
Write-Host -Object "Auto login should be setup on base image if not, attempting to add it now";
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1" -type String
Set-ItemProperty $RegPath "DefaultUsername" -Value "vagrant" -type String
Set-ItemProperty $RegPath "DefaultPassword" -Value "vagrant" -type String
Write-Host -Object "Enabling logs for schedule tasks";
$logName = 'Microsoft-Windows-TaskScheduler/Operational'
$log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName
$log.IsEnabled=$true
$log.SaveChanges()
Write-Host -Object "downloading $fromfile4";
$webclient.DownloadFile($fromfile4, $tofile4)