|
Write-Host "Start copying files …" . |
|
|
|
#region Variables |
|
|
|
# Type of laptop |
|
$Machine = "DellXPS13" |
|
Write-Host " Machinetype:" $Machine |
|
|
|
# Source folders |
|
$OSDRepo = Join-Path $ENV:OneDriveCommercial "ITStuff\OSD\OSDRepository" |
|
$OSDScripts = Join-Path $ENV:OneDriveCommercial "ITStuff\OSD\OSDScripts" |
|
$OSDSettings = Join-Path $ENV:OneDriveCommercial "ITStuff\OSD\OSDSettings" |
|
|
|
Write-Host " Source:" $OSDRepo |
|
Write-Host " Source:" $OSDScripts |
|
Write-Host " Source:" $OSDSettings |
|
|
|
# Destination |
|
$OSDWinSetup = Join-Path $ENV:SystemDrive "OSDWinSetup" |
|
Write-Host " Destination:" $OSDWinSetup |
|
|
|
#endregion |
|
|
|
#region Create Folder Structure OSDWinSetup |
|
|
|
Write-Host "Creating folder structure" |
|
|
|
if (Test-Path $OSDWinSetup){Remove-Item –Path $OSDWinSetup –Recurse | Out-Null} |
|
|
|
$folders = "$OSDWinSetup", |
|
"$OSDWinSetup\Docs", |
|
"$OSDWinSetup\Drivers", |
|
"$OSDWinSetup\Graphics", |
|
"$OSDWinsetup\Logs", |
|
"$OSDWinSetup\Modules", |
|
"$OSDWinSetup\Programs", |
|
"$OSDWinSetup\Scripts", |
|
"$OSDWinSetup\Settings", |
|
"$OSDWinSetup\Temp" |
|
|
|
foreach ($folder in $folders){ |
|
New-Item –type Directory $folder | Out-Null |
|
write-host –ForegroundColor cyan " $folder" |
|
} |
|
|
|
#endregion |
|
|
|
#region Copy files and folders |
|
Write-Host "Copying files and folders" |
|
|
|
Copy-Item –Path "$OSDRepo\Programs\Office365Insider\*" –Destination "$OSDWinsetup\Programs\Office" –Recurse |
|
Copy-Item –Path "$OSDRepo\Programs\rztools" –Destination "$OSDWinsetup\Programs" –Recurse |
|
Copy-Item –Path "$OSDRepo\Programs\7zip" –Destination "$OSDWinsetup\Programs" –Recurse |
|
Copy-Item –Path "$OSDRepo\Graphics\$Machine\*" –Destination "$OSDWinsetup\Graphics" –Recurse |
|
Copy-Item –Path "$OSDRepo\Graphics\Fonts" –Destination "$OSDWinsetup\Graphics" –Recurse |
|
Copy-Item –Path "$OSDScripts\Modules\OSDModule" –Destination "$OSDWinsetup\Modules" –Recurse |
|
Copy-Item –Path "$OSDScripts\$Machine\*" –Destination "$OSDWinsetup\Scripts" –Recurse |
|
Copy-Item –Path "$OSDSettings\$Machine\*" –Destination "$OSDWinsetup\Settings" –Recurse |
|
|
|
# Copy main script file |
|
Copy-Item –Path "$OSDScripts\$Machine\setup.ps1" –Destination $OSDWinsetup |
|
|
|
# Copy setting files |
|
Copy-Item –Path "$OSDSettings\$Machine\OfficeConfiguration.xml" –Destination "$OSDWinsetup\Settings" |
|
|
|
#endregion |
|
|
|
#region Make info file |
|
|
|
$Info = "Creating WinSetup folder" |
|
$InfoFile = "$Machine" + "-README.md" |
|
New-Item –Path $OSDWinSetup\$InfoFile –ItemType File | Out-Null |
|
Set-Content –Path "$OSDWinSetup\$InfoFile" –Value $Info | Out-Null |
|
|
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Machinetype: $Machine" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Source: $OSDRepo" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Source: $OSDScripts" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Source: $OSDSettings" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Destination: $OSDWinSetup`n" | Out-Null |
|
|
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Office 365 Insider" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "7zip" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "rzTools" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Graphics" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Fonts" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "OSDModule" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Scripts" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "Settings" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "setup.ps1" | Out-Null |
|
Add-Content –Path "$OSDWinSetup\$InfoFile" –Value "OfficeConfiguration.xml" | Out-Null |
|
|
|
#endregion |
|
|
|
#region Div |
|
|
|
# Open OSDWinSetup folder |
|
explorer.exe C:\OSDWinSetup |
|
|
|
#endregion |