Public/Functions/OSDCloud/Enable-OSDCloudODT.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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
function Enable-OSDCloudODT { <# .SYNOPSIS Enables ODT Support in an OSDCloud Workspace .DESCRIPTION Enables ODT Support in an OSDCloud Workspace .LINK https://github.com/OSDeploy/OSD/tree/master/Docs #> [CmdletBinding()] param () #================================================= # Start the Clock #================================================= $ODTStartTime = Get-Date #================================================= # Blocks #================================================= Block-WinPE Block-StandardUser Block-WindowsVersionNe10 Block-PowerShellVersionLt5 Block-NoCurl #================================================= # Get-OSDCloudTemplate #================================================= if (-NOT (Get-OSDCloudTemplate)) { Write-Warning "Setting up a new OSDCloudTemplate" New-OSDCloudTemplate -Verbose } $OSDCloudTemplate = Get-OSDCloudTemplate if (-NOT ($OSDCloudTemplate)) { Write-Warning "Something bad happened. I have to go" Break } #================================================= # Set WorkspacePath #================================================= $WorkspacePath = Get-OSDCloudWorkspace -ErrorAction Stop #================================================= # Setup Workspace #================================================= if (-NOT ($WorkspacePath)) { Write-Warning "You need to provide a path to your Workspace with one of the following examples" Write-Warning "Set-OSDCloudWorkspace -WorkspacePath C:\OSDCloud" Break } if (-NOT (Test-Path $WorkspacePath)) { New-OSDCloudWorkspace -WorkspacePath $WorkspacePath -Verbose -ErrorAction Stop } if (-NOT (Test-Path "$WorkspacePath\Media")) { New-OSDCloudWorkspace -WorkspacePath $WorkspacePath -Verbose -ErrorAction Stop } if (-NOT (Test-Path "$WorkspacePath\Media\sources\boot.wim")) { Write-Warning "Nothing is going well for you today my friend" Break } #================================================= # O365ProPlusRetail Configurations #================================================= $O365ProPlusRetailCurrent = @' <Configuration ID="4d85475a-3aea-4fcb-877a-85841651fb69"> <Add OfficeClientEdition="64" Channel="Current"> <Product ID="O365ProPlusRetail"> <Language ID="MatchOS" /> <ExcludeApp ID="Groove" /> </Product> </Add> <Property Name="SharedComputerLicensing" Value="0" /> <Property Name="SCLCacheOverride" Value="0" /> <Property Name="AUTOACTIVATE" Value="0" /> <Property Name="FORCEAPPSHUTDOWN" Value="FALSE" /> <Property Name="DeviceBasedLicensing" Value="0" /> <Updates Enabled="TRUE" /> <RemoveMSI /> <Display Level="Full" AcceptEULA="TRUE" /> </Configuration> '@ $O365ProPlusRetailMonthlyEnterprise = @' <Configuration ID="002634c3-bedd-416a-82ea-764d564ec07a"> <Add OfficeClientEdition="64" Channel="MonthlyEnterprise"> <Product ID="O365ProPlusRetail"> <Language ID="MatchOS" /> <ExcludeApp ID="Groove" /> </Product> </Add> <Property Name="SharedComputerLicensing" Value="0" /> <Property Name="SCLCacheOverride" Value="0" /> <Property Name="AUTOACTIVATE" Value="0" /> <Property Name="FORCEAPPSHUTDOWN" Value="FALSE" /> <Property Name="DeviceBasedLicensing" Value="0" /> <Updates Enabled="TRUE" /> <RemoveMSI /> <Display Level="Full" AcceptEULA="TRUE" /> </Configuration> '@ $O365ProPlusRetailSemiAnnual = @' <Configuration ID="4c075323-cc94-4689-85d1-43719cc99f01"> <Add OfficeClientEdition="64" Channel="SemiAnnual"> <Product ID="O365ProPlusRetail"> <Language ID="MatchOS" /> <ExcludeApp ID="Groove" /> </Product> </Add> <Property Name="SharedComputerLicensing" Value="0" /> <Property Name="SCLCacheOverride" Value="0" /> <Property Name="AUTOACTIVATE" Value="0" /> <Property Name="FORCEAPPSHUTDOWN" Value="FALSE" /> <Property Name="DeviceBasedLicensing" Value="0" /> <Updates Enabled="TRUE" /> <RemoveMSI /> <Display Level="Full" AcceptEULA="TRUE" /> </Configuration> '@ $O365ProPlusRetailSemiAnnualPreview = @' <Configuration ID="3d9984f2-c89e-4b93-93c4-4415f960cbe0"> <Add OfficeClientEdition="64" Channel="SemiAnnualPreview"> <Product ID="O365ProPlusRetail"> <Language ID="MatchOS" /> <ExcludeApp ID="Groove" /> </Product> </Add> <Property Name="SharedComputerLicensing" Value="0" /> <Property Name="SCLCacheOverride" Value="0" /> <Property Name="AUTOACTIVATE" Value="0" /> <Property Name="FORCEAPPSHUTDOWN" Value="FALSE" /> <Property Name="DeviceBasedLicensing" Value="0" /> <Updates Enabled="TRUE" /> <RemoveMSI /> <Display Level="Full" AcceptEULA="TRUE" /> </Configuration> '@ $ProPlus2019Volume = @' <Configuration ID="fbce83bd-7a92-4627-84e5-c08baf3dc13d"> <Add OfficeClientEdition="64" Channel="PerpetualVL2019"> <Product ID="ProPlus2019Volume" PIDKEY="NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP"> <Language ID="MatchOS" /> <ExcludeApp ID="Groove" /> </Product> </Add> <Property Name="SharedComputerLicensing" Value="0" /> <Property Name="SCLCacheOverride" Value="0" /> <Property Name="AUTOACTIVATE" Value="0" /> <Property Name="FORCEAPPSHUTDOWN" Value="FALSE" /> <Property Name="DeviceBasedLicensing" Value="0" /> <Updates Enabled="TRUE" /> <RemoveMSI /> <Display Level="Full" AcceptEULA="TRUE" /> </Configuration> '@ #================================================= # Enable OSDCloud ODT #================================================= if (Test-WebConnection -Uri 'https://www.microsoft.com/en-us/download') { $ODTPageLinks = (Invoke-WebRequest -Uri 'https://www.microsoft.com/en-us/download/confirmation.aspx?id=49117' -UseBasicParsing).Links $ODTDownload = ($ODTPageLinks | Where-Object {$_.outerHTML -like "*click here to download manually*"}).href Write-Verbose "Downloading $ODTDownload" $ODTFile = Save-WebFile -SourceUrl $ODTDownload -DestinationDirectory "$WorkspacePath\ODT" -Overwrite #Create Paths if (!(Test-Path "$WorkspacePath\ODT\O365ProPlusRetail\Current")) {New-Item -Path "$WorkspacePath\ODT\O365ProPlusRetail\Current" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$WorkspacePath\ODT\O365ProPlusRetail\MonthlyEnterprise")) {New-Item -Path "$WorkspacePath\ODT\O365ProPlusRetail\MonthlyEnterprise" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnual")) {New-Item -Path "$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnual" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnualPreview")) {New-Item -Path "$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnualPreview" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$WorkspacePath\ODT\ProPlus2019Volume\PerpetualVL2019")) {New-Item -Path "$WorkspacePath\ODT\ProPlus2019Volume\PerpetualVL2019" -ItemType Directory -Force | Out-Null} $O365ProPlusRetailCurrent | Out-File -FilePath "$WorkspacePath\ODT\O365ProPlusRetail\Current\OSD M365 Current.xml" -Encoding utf8 $O365ProPlusRetailMonthlyEnterprise | Out-File -FilePath "$WorkspacePath\ODT\O365ProPlusRetail\MonthlyEnterprise\OSD M365 Monthly Enterprise.xml" -Encoding utf8 $O365ProPlusRetailSemiAnnual | Out-File -FilePath "$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnual\OSD M365 Semi-Annual.xml" -Encoding utf8 $O365ProPlusRetailSemiAnnualPreview | Out-File -FilePath "$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnualPreview\OSD M365 Semi-Annual Preview.xml" -Encoding utf8 $ProPlus2019Volume | Out-File -FilePath "$WorkspacePath\ODT\ProPlus2019Volume\PerpetualVL2019\OSD Office Professional Plus 2019.xml" -Encoding utf8 if (Test-Path $ODTFile.FullName) { Write-Verbose "Expanding $($ODTFile.FullName) to $WorkspacePath\ODT\O365ProPlusRetail\Current" & $ODTFile.FullName /quiet /extract:"$WorkspacePath\ODT\O365ProPlusRetail\Current" Write-Verbose "Expanding $($ODTFile.FullName) to $WorkspacePath\ODT\O365ProPlusRetail\MonthlyEnterprise" & $ODTFile.FullName /quiet /extract:"$WorkspacePath\ODT\O365ProPlusRetail\MonthlyEnterprise" Write-Verbose "Expanding $($ODTFile.FullName) to $WorkspacePath\ODT\O365ProPlusRetail\SemiAnnual" & $ODTFile.FullName /quiet /extract:"$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnual" Write-Verbose "Expanding $($ODTFile.FullName) to $WorkspacePath\ODT\O365ProPlusRetail\SemiAnnualPreview" & $ODTFile.FullName /quiet /extract:"$WorkspacePath\ODT\O365ProPlusRetail\SemiAnnualPreview" Write-Verbose "Expanding $($ODTFile.FullName) to $WorkspacePath\ODT\ProPlus2019Volume\PerpetualVL2019" & $ODTFile.FullName /quiet /extract:"$WorkspacePath\ODT\ProPlus2019Volume\PerpetualVL2019" } Start-Sleep -Seconds 3 Get-ChildItem -Path "$WorkspacePath\ODT\" -Include 'configuration-Office365-x64.xml' -Recurse | Remove-Item Get-ChildItem -Path "$WorkspacePath\ODT\" -Include 'configuration-Office365-x86.xml' -Recurse | Remove-Item Get-ChildItem -Path "$WorkspacePath\ODT\" -Include 'configuration-Office2019Enterprise.xml' -Recurse | Remove-Item } #================================================= # Complete #================================================= $ODTEndTime = Get-Date $ODTTimeSpan = New-TimeSpan -Start $ODTStartTime -End $ODTEndTime Write-Host -ForegroundColor DarkGray "================================================" Write-Host -ForegroundColor Yellow "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) $($MyInvocation.MyCommand.Name) " -NoNewline Write-Host -ForegroundColor Cyan "Completed in $($ODTTimeSpan.ToString("mm' minutes 'ss' seconds'"))" #================================================= } |