[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials $env:APPDATA = "C:\Windows\System32\Config\SystemProfile\AppData\Roaming" $env:LOCALAPPDATA = "C:\Windows\System32\Config\SystemProfile\AppData\Local" $Env:PSModulePath = $env:PSModulePath+";C:\Program Files\WindowsPowerShell\Scripts" $env:Path = $env:Path+";C:\Program Files\WindowsPowerShell\Scripts" $Global:Transcript = "$((Get-Date).ToString('yyyy-MM-dd-HHmmss'))-SplashScreen.log" Start-Transcript -Path (Join-Path "$env:ProgramData\Microsoft\IntuneManagementExtension\Logs\OSD\" $Global:Transcript) -ErrorAction Ignore | Out-Null $Scripts2run = @( @{ Name = "Enabling built-in Windows Producy Key" Script = "https://raw.githubusercontent.com/FlorianSLZ/OSDCloud-Stuff/main/OOBE/Set-EmbeddedWINKey.ps1" }, @{ Name = "Windows Quality Updates" Script = "https://raw.githubusercontent.com/FlorianSLZ/OSDCloud-Stuff/main/OOBE/Windows-Updates_Quality.ps1" }, @{ Name = "Windows Firmware and Driver Updates" Script = "https://raw.githubusercontent.com/FlorianSLZ/OSDCloud-Stuff/main/OOBE/Windows-Updates_DriverFirmware.ps1" }, @{ Name = "Saving Logs and Cleanup" Script = "https://raw.githubusercontent.com/FlorianSLZ/OSDCloud-Stuff/main/OOBE/OSDCloud-CleanUp.ps1" }, @{ Name = "Sending Reboot Command" Script = "shutdown.exe -r -f -t 20" } ) Write-Host "Checking Internet Connection..." $NetworkCheck = "powershellgallery.com" $TimeoutInSeconds = 120 # 2 minutes $ElapsedTime = 0 $SleepTime = 5 while (-not (Test-Connection $NetworkCheck -Count 1 -Quiet) -and ($ElapsedTime -lt $TimeoutInSeconds)) { Start-Sleep -Seconds $SleepTime $ElapsedTime += $SleepTime } if ($ElapsedTime -ge $TimeoutInSeconds) { Write-Error "Timeout reached after 2 minutes without a connection." exit 1 } else { Write-Host "Internet connection established after $ElapsedTime s." -ForegroundColor Green } Write-Host "Starting Windows Updates, Activation and installation of additional languages..." Install-PackageProvider -Name NuGet -Force | Out-Null $PSGalleryIP = (Get-PSRepository -Name PSGallery).InstallationPolicy if ($PSGalleryIP -eq 'Untrusted') { Write-DarkGrayHost "Set-PSRepository -Name PSGallery -InstallationPolicy Trusted" Set-PSRepository -Name PSGallery -InstallationPolicy Trusted } Install-Script Start-SplashScreen -Force | Out-Null Start-SplashScreen.ps1 -MessageHeader "Akos OSDCloud" -Processes $Scripts2run -LogoURL "https://scloud.work/wp-content/uploads/2023/08/terminal-logo-scloud.png" Stop-Transcript