-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOSDCloudBuildv1.0.ps1
123 lines (109 loc) · 4.15 KB
/
OSDCloudBuildv1.0.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#================================================
# OSDCloud Build Sequence
# WARNING: Will wipe hard drive without prompt!!
# Windows 10 21H2 Pro en-gb Retail
# Deploys OS
# Updates OS
# Removes AppX Packages from OS
# No Office Deployment Tool
# Creates post deployment scripts for Autopilot
#================================================
# PreOS
# Set VM Display Resolution
if ((Get-MyComputerModel) -match 'Virtual') {
Write-Host -ForegroundColor Cyan "Setting Display Resolution to 1600x"
Set-DisRes 1600
}
#================================================
# PreOS
# Install and Import OSD Module
Install-Module OSD -Force
Import-Module OSD -Force
#================================================
# [OS] Start-OSDCloud with Params
#================================================
$Params = @{
OSBuild = "21H2"
OSEdition = "Pro"
OSLanguage = "en-gb"
OSLicense = "Retail"
SkipAutopilot = $true
SkipODT = $true
ZTI = $True
}
Start-OSDCloud @Params
#================================================
# WinPE PostOS Sample
# AutopilotOOBE Offline Staging
#================================================
Install-Module AutopilotOOBE -Force
Import-Module AutopilotOOBE -Force
$Params = @{
Title = 'Autopilot Registration'
GroupTagOptions = 'ISL'
Hidden = 'AddToGroup','AssignedComputerName','AssignedUser','PostAction'
Assign = $true
PostAction = 'Restart'
Run = 'PowerShell'
Disabled = 'Assign'
}
AutopilotOOBE @Params
#================================================
# WinPE PostOS Sample
# OOBEDeploy Offline Staging
#================================================
$Params = @{
Autopilot = $true
RemoveAppx = "CommunicationsApps","OfficeHub","People","Skype","Solitaire","Xbox","ZuneMusic","ZuneVideo"
UpdateDrivers = $true
UpdateWindows = $true
}
Start-OOBEDeploy @Params
#================================================
# WinPE PostOS
# Set OOBEDeploy CMD.ps1
#================================================
$SetCommand = @'
@echo off
:: Set the PowerShell Execution Policy
PowerShell -NoL -Com Set-ExecutionPolicy RemoteSigned -Force
:: Add PowerShell Scripts to the Path
set path=%path%;C:\Program Files\WindowsPowerShell\Scripts
:: Open and Minimize a PowerShell instance just in case
start PowerShell -NoL -W Mi
:: Install the latest OSD Module
start "Install-Module OSD" /wait PowerShell -NoL -C Install-Module OSD -Force -Verbose
:: Start-OOBEDeploy
:: The next line assumes that you have a configuration saved in C:\ProgramData\OSDeploy\OSDeploy.OOBEDeploy.json
start "Start-OOBEDeploy" PowerShell -NoL -C Start-OOBEDeploy
exit
'@
$SetCommand | Out-File -FilePath "C:\Windows\OOBEDeploy.cmd" -Encoding ascii -Force
#================================================
# WinPE PostOS
# Set AutopilotOOBE CMD.ps1
#================================================
$SetCommand = @'
@echo off
:: Set the PowerShell Execution Policy
PowerShell -NoL -Com Set-ExecutionPolicy RemoteSigned -Force
:: Add PowerShell Scripts to the Path
set path=%path%;C:\Program Files\WindowsPowerShell\Scripts
:: Open and Minimize a PowerShell instance just in case
start PowerShell -NoL -W Mi
:: Install the latest AutopilotOOBE Module
start "Install-Module AutopilotOOBE" /wait PowerShell -NoL -C Install-Module AutopilotOOBE -Force -Verbose
:: Start-AutopilotOOBE
:: The next line assumes that you have a configuration saved in C:\ProgramData\OSDeploy\OSDeploy.AutopilotOOBE.json
start "Start-AutopilotOOBE" PowerShell -NoL -C Start-AutopilotOOBE
exit
'@
$SetCommand | Out-File -FilePath "C:\Windows\Autopilot.cmd" -Encoding ascii -Force
#================================================
# PostOS
# Shutdown-Computer & Display Message
#================================================
Write-Host -Foregroundcolor Red "IMPORTANT! - " -Nonewline
Read-Host "Ensure to run the OOBEDeploy.cmd to complete the Autopilot readiness build, device will now shutdown
,remember to update the boot order to HDD before proceeding with phase 2, press the ENTER key to continue...."
Wpeutil Shutdown