Browse Source

Update CI/CD scripts

pull/401/head
Dmitry Nefedov 2 years ago
parent
commit
64c4b488eb
  1. 52
      Scripts/Dependencies.ps1
  2. 20
      Scripts/Windows_10.ps1
  3. 26
      Scripts/Windows_10_LTSC_2019.ps1
  4. 20
      Scripts/Windows_10_LTSC_2021.ps1
  5. 20
      Scripts/Windows_10_PS_7.ps1
  6. 20
      Scripts/Windows_11.ps1
  7. 20
      Scripts/Windows_11_PS_7.ps1

52
Scripts/Dependencies.ps1

@ -1,42 +1,38 @@
Write-Verbose -Message Dependencies -Verbose
# Download PolicyFileEditor
# https://github.com/dlwyatt/PolicyFileEditor
# Download LGPO
# https://techcommunity.microsoft.com/t5/microsoft-security-baselines/lgpo-exe-local-group-policy-object-utility-v1-0/ba-p/701045
$Parameters = @{
Uri = "https://api.github.com/repos/dlwyatt/PolicyFileEditor/releases/latest"
UseBasicParsing = $true
}
$LatestPolicyFileEditorVersion = (Invoke-RestMethod @Parameters).tag_name
$Parameters = @{
Uri = "https://github.com/dlwyatt/PolicyFileEditor/archive/refs/tags/$LatestPolicyFileEditorVersion.zip"
OutFile = "Scripts\$LatestPolicyFileEditorVersion.zip"
UseBasicParsing = $true
Verbose = $true
Uri = "https://download.microsoft.com/download/8/5/C/85C25433-A1B0-4FFA-9429-7E023E7DA8D8/LGPO.zip"
OutFile = "Scripts\LGPO.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Expand zip archive
$Parameters = @{
Path = "Scripts\$LatestPolicyFileEditorVersion.zip"
DestinationPath = "Scripts"
Force = $true
Verbose = $true
Path = "Scripts\LGPO.zip"
DestinationPath = "Scripts"
Force = $true
Verbose = $true
}
Expand-Archive @Parameters
$Path = @(
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\DscResources",
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\en-US",
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\build.psake.ps1",
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\LICENSE",
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\PolicyFileEditor.Tests.ps1",
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\README.md"
)
Remove-Item -Path $Path -Recurse -Force
Rename-Item -Path "Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion" -NewName "PolicyFileEditor" -Force
$Parameters = @{
Path = "Scripts\LGPO_30\LGPO.exe"
Destination = Scripts
Force = $true
}
Move-Item @Parameters
Remove-Item -Path "Scripts\LGPO_30", "Scripts\LGPO.zip" -Recurse -Force
# Download Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll
$Parameters = @{
Uri = "https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.NET.Ref"
OutFile = "Scripts\microsoft.windows.sdk.net.ref.zip"
UseBasicParsing = $true
Uri = "https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.NET.Ref"
OutFile = "Scripts\microsoft.windows.sdk.net.ref.zip"
UseBasicParsing = $true
}
Invoke-RestMethod @Parameters
# Extract Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll from archive

20
Scripts/Windows_10.ps1

@ -1,6 +1,6 @@
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1
@ -9,24 +9,24 @@ Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Verbo
New-Item -Path "Sophia_Script_for_Windows_10_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia_Script_for_Windows_10_v$LatestRelease\bin"
Recurse = $true
Force = $true
Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_10_v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "src\Sophia_Script_for_Windows_10" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia_Script_for_Windows_10_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
Path = "Sophia_Script_for_Windows_10_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding utf8 -Force

26
Scripts/Windows_10_LTSC_2019.ps1

@ -1,26 +1,32 @@
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019
Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\bin"
Recurse = $true
Force = $true
Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_LTSC_2019" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
Path = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding utf8 -Force

20
Scripts/Windows_10_LTSC_2021.ps1

@ -1,6 +1,6 @@
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021
@ -9,24 +9,24 @@ Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.z
New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\bin"
Recurse = $true
Force = $true
Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_LTSC_2021" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
Path = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding utf8 -Force

20
Scripts/Windows_10_PS_7.ps1

@ -1,6 +1,6 @@
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
@ -9,24 +9,24 @@ Write-Verbose -Message "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestReleas
New-Item -Path "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\bin"
Recurse = $true
Force = $true
Path = @("Scripts\LGPO.exe", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_PowerShell_7" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
Path = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding utf8 -Force

20
Scripts/Windows_11.ps1

@ -1,6 +1,6 @@
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
@ -9,24 +9,24 @@ Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbo
New-Item -Path "Sophia_Script_for_Windows_11_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia_Script_for_Windows_11_v$LatestRelease\bin"
Recurse = $true
Force = $true
Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_11_v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "src\Sophia_Script_for_Windows_11" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_11_v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia_Script_for_Windows_11_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
Path = "Sophia_Script_for_Windows_11_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding utf8 -Force

20
Scripts/Windows_11_PS_7.ps1

@ -1,6 +1,6 @@
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
@ -9,24 +9,24 @@ Write-Verbose -Message "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestReleas
New-Item -Path "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\bin"
Recurse = $true
Force = $true
Path = @("Scripts\LGPO.exe", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "src\Sophia_Script_for_Windows_11_PowerShell_7" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
Path = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding utf8 -Force

Loading…
Cancel
Save