core/samples/boot-winpescript/custom-startnet.ps1
|
#Requires -RunAsAdministrator #================================================= $ScriptSource = $MyInvocation.MyCommand.Source $Architecture = $global:BuildMedia.Architecture $MountPath = $global:BuildMedia.MountPath $WinPEAppsPath = $global:BuildMedia.WinPEAppsPath #================================================= # Validate MountPath if (-not $MountPath) { Write-Warning "[$(Get-Date -Format s)] [$ScriptSource] `$MountPath is not set. Exiting." return } if (-not (Test-Path -Path $MountPath)) { Write-Warning "[$(Get-Date -Format s)] [$ScriptSource] MountPath does not exist: $MountPath" return } #================================================= # X:\Windows\System32\startnet.cmd $BuildDate = Get-Date -Format 'yy.M.d' $startnetCmd = @" @echo off title OSDCloud WinPEStartup $BuildDate (close window to restart computer) PowerShell -Nol -C Invoke-WinPEStartup "@ $startnetCmdPath = "$MountPath\Windows\System32\startnet.cmd" Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] [$ScriptSource] Adding $startnetCmdPath" $startnetCmd | Out-File -FilePath $startnetCmdPath -Encoding ascii -Width 2000 -Force #================================================= |