-
Notifications
You must be signed in to change notification settings - Fork 0
/
DISMTools-Install.ps1
29 lines (23 loc) · 1.52 KB
/
DISMTools-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
# UnattendGen - DISMTools Self-Contained Installer
param (
[Parameter(Mandatory = $true, Position = 0)] [string] $tag
)
[Net.ServicePointManager]::SecurityProtocol = "Tls12"
Write-Host "Downloading self-contained UnattendGen..."
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/CodingWonders/UnattendGen/releases/download/$tag/UnattendGen-x64--SelfContained.zip" -OutFile ".\unattendgen-sc-amd64.zip"
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/CodingWonders/UnattendGen/releases/download/$tag/UnattendGen-x86--SelfContained.zip" -OutFile ".\unattendgen-sc-x86.zip"
$ProgressPreference = 'Continue'
Write-Host "Expanding archives..."
Expand-Archive -Path ".\unattendgen-sc-amd64.zip" -Destination ".\Tools\UnattendGen\SelfContained\amd64" -Force
Expand-Archive -Path ".\unattendgen-sc-x86.zip" -Destination ".\Tools\UnattendGen\SelfContained\x86" -Force
if ($?)
{
New-Item -Path "$((Get-Location).Path)\Tools\UnattendGen\SelfContained\amd64\DT" -ItemType File -Force | Out-Null
Set-ItemProperty -Path "$((Get-Location).Path)\Tools\UnattendGen\SelfContained\amd64\DT" -Name Attributes -Value Hidden
New-Item -Path "$((Get-Location).Path)\Tools\UnattendGen\SelfContained\x86\DT" -ItemType File -Force | Out-Null
Set-ItemProperty -Path "$((Get-Location).Path)\Tools\UnattendGen\SelfContained\x86\DT" -Name Attributes -Value Hidden
}
Write-Host "Deleting temporary files..."
Remove-Item -Path ".\unattendgen-sc-amd64.zip" -Force
Remove-Item -Path ".\unattendgen-sc-x86.zip" -Force