Last active
April 30, 2019 15:10
-
-
Save brianfgonzalez/4459fb99158bf4f3178fbd4714c76b80 to your computer and use it in GitHub Desktop.
Run this script as an administrator on a clean Windows 10 installation. It will install MDT (w/ADK), download and import the initial OS files, create a Capture and OEM TS, and downloads and imports an initial CAB package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
This script performs the installation of MDT including dependencies. | |
# LICENSE # | |
PowerShell EasyMdt BG edition | |
Copyright (C) 2019 - Brian Gonzalez. | |
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. | |
.DESCRIPTION | |
This script sets up MDT including it's dependencies. It also performs some basic configurations. | |
.EXAMPLE | |
easymdt_bg.ps1 | |
.NOTES | |
Run this script on a clean installation of Windows WITH internet connectivity. It downloads roughly 3gb of content. | |
.LINK | |
http://easymdt.org | |
#> | |
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNull()] | |
[System.IO.FileInfo]$DSPath = 'C:\DS', | |
[Parameter(Mandatory=$false)] | |
[string]$CabUrl = "ftp://ftp.panasonic.com/computer/cab/20EFGH_Mk2_Win10x64_1809_V100.cab" | |
) | |
Start-Transcript -Path "$PSScriptRoot\easymdt_bg.txt" | |
$CabName = ($CabUrl -split '\/')[-1] | |
If ($CabName.EndsWith('.cab') -eq $false) | |
{ | |
Write-Host "Passed CabUrl must end in .cab" | |
Pause | |
Exit | |
} | |
# Set power plan to High Performance | |
powercfg.exe -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c | |
# Create CabNameNoExt | |
$CabNameNoExt = ($CabName -split '\.')[0] | |
# Install Chocolately | |
Write-Output "Installing Chocolately..." | |
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
# Install mdt,adk,7zip,n++,and sccm toolkit (cmtrace) | |
Write-Output "Installing ADK,MDT, and other apps..." | |
cinst windows-adk-deploy mdt sccmtoolkit 7zip notepadplusplus --confirm | |
# Create the MDT service account | |
New-LocalUser "mdt" -Password (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force) -FullName "mdt" -Description "Service account for MDT." | |
Add-LocalGroupMember -Group "Administrators" -Member "mdt" | |
Set-LocalUser -Name "mdt" -PasswordNeverExpires $true | |
# Create the MDT Deployment Share | |
Write-Output "Creating Deployment Share (C:\DS)..." | |
Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1" | |
New-PSDrive -Name "DS001" -PSProvider MDTProvider -Root $DsPath | |
New-Item -path "DS001:\Task Sequences" -enable "True" -Name "Development" -Comments "" -ItemType "folder" -Verbose | |
New-Item -path "DS001:\Task Sequences" -enable "True" -Name "Windows 10" -Comments "" -ItemType "folder" -Verbose | |
# Update the Bootstrap.ini file | |
$bootstrapIni = @" | |
[Settings] | |
Priority=Default | |
[Default] | |
DeployRoot=\\$env:COMPUTERNAME\DS | |
SkipBDDWelcome=YES | |
UserDomain=$env:COMPUTERNAME | |
UserID=mdt | |
UserPassword=P@ssw0rd | |
"@ | |
Set-Content -Path "C:\DS\Control\Bootstrap.ini" -Value $bootstrapIni -Force -Confirm:$false | |
# Update the CustomSettings.ini file | |
$CustomSettingsIni = @" | |
[Settings] | |
Priority=Product,OSVersion,Default | |
Properties=MyCustomProperty | |
[Default] | |
_SMSTSOrgName = Panasonic | |
_SMSTSPackageName = %TaskSequenceName% | |
;TaskSequenceID=DEP-1809-001 | |
OSInstall=Y | |
SkipAdminPassword=YES | |
SkipProductKey=YES | |
SkipSummary=YES | |
SkipFinalSummary=NO | |
SkipDomainMembership=YES | |
JoinWorkgroup=WORKGROUP | |
SkipUserData=YES | |
UserDataLocation=NONE | |
SkipBitLocker=YES | |
BDEInstallSuppress=YES | |
SkipLocaleSelection=YES | |
SkipTimeZone=YES | |
KeyboardLocale=en-US | |
UserLocale=en-US | |
UILanguage=en-US | |
TimeZone=035 | |
TimeZoneName=Eastern Standard Time | |
ApplyGPOPack=NO | |
EventService=http://$env:COMPUTERNAME:9800 | |
SLShare=%DEPLOYROOT%\Logs | |
"@ | |
Set-Content -Path "C:\DS\Control\CustomSettings.ini" -Value $CustomSettingsIni -Force -Confirm:$false | |
# Create LiteTouch Boot WIM & ISO | |
Write-Output "Creating LiteTouch Boot Media..." | |
Update-MDTDeploymentShare -path "DS001:" -Force -Verbose -ErrorAction Stop | |
# Downloading Windows 10 1809 x64 trial ISO | |
Write-Output "Downloading Windows 10 1809 x64 trial ISO..." | |
$params = @{ | |
Source = "https://software-download.microsoft.com/download/sg/17763.107.101029-1455.rs5_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso" | |
Destination = "$PSScriptRoot\W10x64_1809.iso" | |
ErrorAction = "Stop" | |
} | |
Start-BitsTransfer @params | |
# Extracting ISO... | |
Write-Output "Extracting ISO with 7zip..." | |
& 'C:\Program Files\7-Zip\7z.exe' x "$PSScriptRoot\W10x64_1809.iso" -o"$PSScriptRoot\W10x64_1809\" | |
# Creating an 1809 folder and importing the extracted ISO... | |
New-Item -path "DS001:\Operating Systems" -enable "True" -Name "Windows 10" -Comments "" -ItemType "folder" -Verbose | |
New-Item -path "DS001:\Operating Systems\Windows 10" -enable "True" -Name "1809" -Comments "" -ItemType "folder" -Verbose | |
Write-Output "Importing Windows 10 1809 x64 trial ISO into MDT..." | |
import-mdtoperatingsystem -path "DS001:\Operating Systems\Windows 10\1809" -SourcePath "$PSScriptRoot\W10x64_1809\" -DestinationFolder "Windows 10 Enterprise Evaluation x64" -Move -Verbose | |
# Creating a Win 10 Sysprep and Capture Task Sequence... | |
import-mdttasksequence -path "DS001:\Task Sequences\Development" -Name "Sysprep and Capture for Win 10" -Template "CaptureOnly.xml" -Comments "" -ID "CAP-10X64-001" -Version "1.0" -OperatingSystemPath "DS001:\Operating Systems\Windows 10\1809\Windows 10 Enterprise Evaluation in Windows 10 Enterprise Evaluation x64 install.wim" -FullName "SupportIsHere" -OrgName "SupportIsHere" -HomePage "http://supportishere.com" -Verbose | |
# Creating a Litetouch OEM Task Sequence... | |
import-mdttasksequence -path "DS001:\Task Sequences\Development" -Name "Cache Deployment to Local HDD" -Template "LTIOEM.xml" -Comments "" -ID "OEM-001" -Version "1.0" -Verbose | |
# Downloading Specified CAB | |
Write-Output "Downloading $CabName (sorry no progress bar, cabs are typically around 1gb)..." | |
$WebClient = New-Object System.Net.WebClient | |
$WebClient.DownloadFile("$CabUrl","$PSScriptRoot\$CabName") | |
# Extract CAB... | |
Write-Output "Extracting CAB with 7zip..." | |
& 'C:\Program Files\7-Zip\7z.exe' x "$PSScriptRoot\$CabName" -o"$PSScriptRoot\cab\" | |
Remove-Item -Path "$PSScriptRoot\$CabName" -Force | |
# Creating a cab folder and importing the extracted cab... | |
New-Item -path "DS001:\Out-of-Box Drivers" -enable "True" -Name "Panasonic" -Comments "" -ItemType "folder" -Verbose | |
New-Item -path "DS001:\Out-of-Box Drivers\Panasonic" -enable "True" -Name "Windows 10" -Comments "" -ItemType "folder" -Verbose | |
New-Item -path "DS001:\Out-of-Box Drivers\Panasonic\Windows 10" -enable "True" -Name "$CabNameNoExt" -Comments "" -ItemType "folder" -Verbose | |
Write-Output "Importing $CabName into MDT..." | |
import-mdtdriver -path "DS001:\Out-of-Box Drivers\Panasonic\Windows 10\$CabNameNoExt" -SourcePath "$PSScriptRoot\cab\" -ImportDuplicates -Verbose | |
new-item -path "DS001:\Selection Profiles" -enable "True" -Name "$CabNameNoExt" -Comments "" -Definition "<SelectionProfile><Include path=`"Out-of-Box Drivers\Panasonic\Windows 10\$CabNameNoExt`" /></SelectionProfile>" -ReadOnly "False" -Verbose | |
remove-item "$PSScriptRoot\cab\" -force -recurse | |
# Download PADT and extract to desktop | |
Write-Output "Downloading PSADT to the desktop..." | |
$WebClient = New-Object System.Net.WebClient | |
$WebClient.DownloadFile("https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/releases/download/v3.7.0/PSAppDeployToolkit_v3.7.0.zip","$PSScriptRoot\PSAppDeployToolkit_v3.7.0.zip") | |
# Extracting PADT to Desktop... | |
Write-Output "Extracting PADT to Desktop..." | |
& 'C:\Program Files\7-Zip\7z.exe' x "$PSScriptRoot\PSAppDeployToolkit_v3.7.0.zip" -o"$env:USERPROFILE\Desktop\PSAppDeployToolkit_v3.7.0\" | |
remove-item "$PSScriptRoot\PSAppDeployToolkit_v3.7.0.zip" -force | |
Stop-Transcript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment