Feat: Create all script path as var

This commit is contained in:
Winston Smith 2021-06-28 16:49:27 +02:00
parent a2d215121a
commit ad2b758ead

View File

@ -5,6 +5,10 @@ echo "GPLv3"
### Considered as finished. Need improvement VM side.
### Define vars
$scripts_path = d:\scripts
### Adding SRV-01
echo "Adding and configuring SRV-01"
@ -14,10 +18,10 @@ $Lettre = Mount-VHD -Path "d:\VHD\SRV-01.VHDx" -PassThru | Get-Disk | Get-Partit
$DriveLetter = $Lettre.DriveLetter
$drive = $DriveLetter + ":"
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
Copy-Item ${scripts_path}\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item ${scripts_path}\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item d:\Scripts\Guests\SRV-01.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item ${scripts_path}\Guests\SRV-01.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\SRV-01.vhdx
@ -47,10 +51,10 @@ $Lettre = Mount-VHD -Path "d:\VHD\SRV-03.VHDx" -PassThru | Get-Disk | Get-Partit
$DriveLetter = $Lettre.DriveLetter
$drive = $DriveLetter + ":"
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
Copy-Item ${scripts_path}\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item ${scripts_path}\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item d:\Scripts\Guests\SRV-03.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item ${scripts_path}\Guests\SRV-03.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\SRV-03.vhdx
@ -82,10 +86,10 @@ $Lettre = Mount-VHD -Path "d:\VHD\RTR-01.VHDx" -PassThru | Get-Disk | Get-Partit
$DriveLetter = $Lettre.DriveLetter
$drive = $DriveLetter + ":"
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
Copy-Item ${scripts_path}\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item ${scripts_path}\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item d:\Scripts\Guests\RTR-01.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item ${scripts_path}\Guests\RTR-01.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\RTR-01.vhdx
@ -119,10 +123,10 @@ $Lettre = Mount-VHD -Path "d:\VHD\RTR-02.VHDx" -PassThru | Get-Disk | Get-Partit
$DriveLetter = $Lettre.DriveLetter
$drive = $DriveLetter + ":"
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
Copy-Item ${scripts_path}\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item ${scripts_path}\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item d:\Scripts\Guests\RTR-02.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item ${scripts_path}\Guests\RTR-02.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\RTR-02.vhdx
@ -156,10 +160,10 @@ $Lettre = Mount-VHD -Path "d:\VHD\RTR-03.VHDx" -PassThru | Get-Disk | Get-Partit
$DriveLetter = $Lettre.DriveLetter
$drive = $DriveLetter + ":"
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
Copy-Item ${scripts_path}\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item ${scripts_path}\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item d:\Scripts\Guests\RTR-03.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item ${scripts_path}\Guests\RTR-03.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\RTR-03.vhdx