From aa71a233bdd9a4b87073433255850b9376ca741a Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Mon, 19 Sep 2022 14:56:42 +0300 Subject: [PATCH] Create Windows_11_PS_7.ps1 --- Scripts/Windows_11_PS_7.ps1 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Scripts/Windows_11_PS_7.ps1 diff --git a/Scripts/Windows_11_PS_7.ps1 b/Scripts/Windows_11_PS_7.ps1 new file mode 100644 index 00000000..70e73d56 --- /dev/null +++ b/Scripts/Windows_11_PS_7.ps1 @@ -0,0 +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" +} +$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 + +Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbose + +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 +} +Copy-Item @Parameters + +Get-ChildItem -Path "Sophia Script\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 +} +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)" +} | Add-Content -Path SHA256SUM -Encoding utf8 -Force