-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_install.ps1
43 lines (31 loc) · 1.73 KB
/
auto_install.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
#if prompt for path use:
#$Drivers = Read-Host "Folder location"
#$showModel = (Get-WmiObject Win32_ComputerSystem).Model
$Drivers = "C:\Users\username\Desktop\drivers\"
#$Drivers = "C:\tmp\$showModel"
#Remove-Item -Path $Drivers -Recurse -Force -ErrorAction Ignore
#if(Test-Path $Drivers)
#{
# Remove-Item -Path $Drivers -Recurse -ErrorAction Ignore
# copy-Item -Path $copyFrom -Destination $Drivers -Recurse -ErrorAction Ignore
#}
#else
#{
# copy-Item -Path $copyFrom -Destination $Drivers -Recurse -ErrorAction Ignore
#}
#if wait for subprocess to finish eg. close windows then use:
#Start-Process $_.FullName -ArgumentList "/S", "/v", "/qn", "/silent", "/accepteula" -NoNewWindow -Wait}
#faster way but some issues with parallel installations is:
# $proc = Start-Process $_.FullName -ArgumentList @("/S", "/v", "/qn", "/silent", "/accepteula") -NoNewWindow
# $proc | Wait-Process}
foreach($Driver in $Drivers)
{
$setup = Get-ChildItem -Path $Drivers -Filter "*.exe" | ForEach-Object {Write-Host $_.FullName
Start-Process $_.FullName -ArgumentList "/S", "/v", "/qn", "/silent", "/accepteula" -NoNewWindow -Wait}
}
foreach($Driver in $Drivers)
{
$setup = Get-ChildItem -Path $Drivers -Recurse -Include *.msi | ForEach-Object {Write-Host $_.FullName
Start-Process msiexec.exe -Args "/I `"$_`" /qb ADDLOCAL=ALL ALLUSERS=TRUE" -Wait
}
}