-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstaller.ps1
38 lines (27 loc) · 1.43 KB
/
installer.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
# http://www.systemcentercentral.com/automating-application-installation-using-powershell-without-dsc-oneget-2/
$source = 'C:\Downloads'
If (!(Test-Path -Path $source -PathType Container)) {New-Item -Path $source -ItemType Directory | Out-Null}
$packages = @(
@{title='7zip Extractor';url='http://7-zip.org/a/7z1700-x64.msi';Arguments=' /qn';Destination=$source},
@{title='Putty 0.63';url='https://app.kabuto.io/dl/cp/13105';Arguments=' /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-';Destination=$source}
@{title='Notepad++ 6.6.8';url='http://download.tuxfamily.org/notepadplus/6.6.8/npp.6.6.8.Installer.exe';Arguments=' /Q /S';Destination=$source}
)
foreach ($package in $packages) {
$packageName = $package.title
$fileName = Split-Path $package.url -Leaf
$destinationPath = $package.Destination + "\" + $fileName
If (!(Test-Path -Path $destinationPath -PathType Leaf)) {
Write-Host "Downloading $packageName"
$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile($package.url,$destinationPath)
}
}
#Once we've downloaded all our files lets install them.
foreach ($package in $packages) {
$packageName = $package.title
$fileName = Split-Path $package.url -Leaf
$destinationPath = $package.Destination + "\" + $fileName
$Arguments = $package.Arguments
Write-Output "Installing $packageName"
Invoke-Expression -Command "$destinationPath $Arguments"
}