diff --git a/.github/workflows/Push_Chocolatey.yml b/.github/workflows/Push_Chocolatey.yml new file mode 100644 index 00000000..57291535 --- /dev/null +++ b/.github/workflows/Push_Chocolatey.yml @@ -0,0 +1,50 @@ +name: Chocolatey push + +on: + workflow_dispatch: + +jobs: + Push: + name: Push + runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@main + + - name: Getting hashes + run: | + . "Scripts\Chocolatey.ps1" + + - name: Pack and push to Chocolatey + run: | + # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/SHA256SUM.json + $Parameters = @{ + Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/refs/heads/master/SHA256SUM.json" + UseBasicParsing = $true + Verbose = $true + } + $SHA256SUM = Invoke-RestMethod @Parameters + + $Parameters = @{ + Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" + } + $Latest_Release = Invoke-RestMethod @Parameters + + # Replace variables with script latest versions + # No need to replace special characters with percent-encoding ones + (Get-Content -Path "chocolatey\tools\chocolateyinstall.ps1" -Encoding utf8 -Raw) | Foreach-Object -Process { + $_ -replace "Hash_Sophia_Script_Windows_10_PowerShell_5_1", $SHA256SUM."Sophia.Script.for.Windows.10.v$($Latest_Release.Sophia_Script_Windows_10_PowerShell_5_1).zip" ` + -replace "Hash_Sophia_Script_Windows_10_PowerShell_7", $SHA256SUM."Sophia.Script.for.Windows.10.PowerShell.7.v$($Latest_Release.Sophia_Script_Windows_10_PowerShell_7).zip" ` + -replace "Hash_Sophia_Script_Windows_10_LTSC2019", $SHA256SUM."Sophia.Script.for.Windows.10.LTSC.2019.v$($Latest_Release.Sophia_Script_Windows_10_LTSC2019).zip" ` + -replace "Hash_Sophia_Script_Windows_10_LTSC2021", $SHA256SUM."Sophia.Script.for.Windows.10.LTSC.2021.v$($Latest_Release.Sophia_Script_Windows_10_LTSC2021).zip" ` + -replace "Hash_Sophia_Script_Windows_11_PowerShell_5_1", $SHA256SUM."Sophia.Script.for.Windows.11.v$($env:Latest_Release_Windows_11_PowerShell_5_1).zip" ` + -replace "Hash_Sophia_Script_Windows_11_PowerShell_7", $SHA256SUM."Sophia.Script.for.Windows.11.PowerShell.7.v$($Latest_Release.Sophia_Script_Windows_11_PowerShell_7).zip" ` + -replace "Hash_Sophia_Script_Windows_11_LTSC2024", $SHA256SUM."Sophia.Script.for.Windows.11.LTSC.2024.v$($Latest_Release.Sophia_Script_Windows_11_LTSC2024).zip" ` + -replace "Hash_Sophia_Script_Wrapper", $SHA256SUM."Sophia.Script.Wrapper.v$($Latest_Release.Sophia_Script_Wrapper).zip" + } | Set-Content -Path "chocolatey\tools\chocolateyinstall.ps1" -Encoding utf8 -Force + + choco pack chocolatey\sophia.nuspec --outputdirectory chocolatey + choco apikey --key ${{ secrets.CHOCOLATEY_SECRET }} --source https://push.chocolatey.org/ + [xml]$Version = Get-Content -Path chocolatey\sophia.nuspec + [string]$Version = $Version.package.metadata.version + choco push chocolatey\sophia.$Version.nupkg --source https://push.chocolatey.org/ --yes diff --git a/.github/workflows/Sophia.yml b/.github/workflows/Sophia.yml index 7982c127..8b3b7522 100644 --- a/.github/workflows/Sophia.yml +++ b/.github/workflows/Sophia.yml @@ -9,11 +9,15 @@ jobs: patch: runs-on: windows-latest timeout-minutes: 5 + permissions: + contents: write steps: - - uses: actions/checkout@main - - name: Signing all .ps1, .psm1, .psd1 files - run: | - . Scripts\Sign.ps1 + - name: Checkout repository + uses: actions/checkout@main + + with: + ref: refs/heads/master + fetch-depth: 0 - name: Dependencies run: | @@ -52,64 +56,40 @@ jobs: . "Scripts\Wrapper.ps1" - name: ReleaseNotesTemplate + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Set $env:GITHUB_REF_NAME variable to use in ps1 file instead of ${{ github.ref_name }} + GITHUB_REF_NAME: ${{ github.ref_name }} id: read_release run: | - # Get a penultimate build tag - $Token = "${{ secrets.GITHUB_TOKEN }}" - $Headers = @{ - Accept = "application/vnd.github+json" - Authorization = "Bearer $Token" - } - $Parameters = @{ - Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases" - Headers = $Headers - UseBasicParsing = $true - Verbose = $true - } - $Penultimate = (Invoke-RestMethod @Parameters).tag_name | Select-Object -Index 1 + . "Scripts\ReleaseNotesTemplate.ps1" + + - name: Adding SHA256SUM.json + run: | + $JSON = @{} + Get-ChildItem -Path . -File | Where-Object -FilterScript {$_.Name -match "zip|exe"} | ForEach-Object -Process { + Write-Verbose -Message "$($_.Name) has $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash) hashsum" -Verbose - # Parse json for the latest script versions - $Parameters = @{ - Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" - UseBasicParsing = $true - Verbose = $true + $JSON += @{ + "$($_.Name)" = "$((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" + } } - $Sophia_Script_Windows_10_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1 - $Sophia_Script_Windows_10_PowerShell_7 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7 - $Sophia_Script_Windows_10_LTSC2019 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019 - $Sophia_Script_Windows_10_LTSC2021 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021 - $Sophia_Script_Windows_11_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 - $Sophia_Script_Windows_11_PowerShell_7 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7 - $Sophia_Script_Windows_11_LTSC2024 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024 - $Sophia_Script_Wrapper = (Invoke-RestMethod @Parameters).Sophia_Script_Wrapper - - # Replace variables with script latest versions - # No need to replace special characters with percent-encoding ones - (Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw) | Foreach-Object -Process { - $_ -replace "NewVersion", "${{ github.ref_name }}" ` - -replace "OldVersion", $Penultimate ` - -replace "Sophia_Script_Windows_10_PowerShell_5_1", $Sophia_Script_Windows_10_PowerShell_5_1 ` - -replace "Sophia_Script_Windows_10_PowerShell_7", $Sophia_Script_Windows_10_PowerShell_7 ` - -replace "Sophia_Script_Windows_10_LTSC2019", $Sophia_Script_Windows_10_LTSC2019 ` - -replace "Sophia_Script_Windows_10_LTSC2021", $Sophia_Script_Windows_10_LTSC2021 ` - -replace "Sophia_Script_Windows_11_PowerShell_5_1", $Sophia_Script_Windows_11_PowerShell_5_1 ` - -replace "Sophia_Script_Windows_11_PowerShell_7", $Sophia_Script_Windows_11_PowerShell_7 ` - -replace "Sophia_Script_Windows_11_LTSC2024", $Sophia_Script_Windows_11_LTSC2024 ` - -replace "Sophia_Script_Wrapper", $Sophia_Script_Wrapper - } | Set-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Force - - # https://trstringer.com/github-actions-multiline-strings/ - Add-Content -Path $env:GITHUB_OUTPUT -Value "ReleaseBody=ReleaseNotesTemplate.md" - - $ReleaseName = Get-Date -f "dd.MM.yyyy" - echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV + $JSON | ConvertTo-Json | Set-Content -Path SHA256SUM.json -Encoding utf8 -Force + + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git add SHA256SUM.json + git commit -m "Update from ${{ github.ref_name }} for adding SHA256SUM.json" + # repository and branch to push to + git push origin HEAD:refs/heads/master - name: Uploading uses: softprops/action-gh-release@master with: name: ${{ steps.read_release.outputs.RELEASE_NAME }} token: ${{ github.token }} + # Use "/" in path to files files: | Sophia*.zip - SHA256SUM + chocolatey/tools/chocolateyinstall.ps1 body_path: ${{ steps.read_release.outputs.ReleaseBody }} diff --git a/.gitignore b/.gitignore index 4e3fe152..3fbb6a08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1 @@ # Exclude user-created configurations -/Sophia Script/*/*.ps1 -!/Sophia Script/*/Functions.ps1 -!/Sophia Script/*/Sophia.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f0811b..cf98b57b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,7 +68,7 @@ Thanks to iGor202512, mogbi, and homeless ## 5.20.1 | 6.8.1 — 19.01.2025 -* Added a tutorial video how to run the specific function(s) via `Functions.ps1` script; +* Added a tutorial video how to run the specific function(s) via `Import-TabCompletion.ps1` script; * * Updated cursor pack for `Cursor` function up to the latest available version from ; * Changed names for functions, having added parameter values to choose: @@ -200,7 +200,7 @@ The imported .ps1 file must be in Sophia Script folder. ## 5.18.7 | 6.6.7 — 12.06.2024 * Fixed `CleanupTask -Register` function not working due to a typo; - * Please re-create it via invoking `. .\Functions.ps1` (with a dot at the beginning) method. + * Please re-create it via invoking `. .\Import-TabCompletion.ps1` (with a dot at the beginning) method. * Removed `CommandLineProcessAudit` and `Install-WSA` as WSA support is deprecated; * Improved `EventViewerCustomView -Disable` function; * Fixed typos; @@ -229,7 +229,7 @@ Closed #576 * Start icon positions are stored in a binary obfuscated JSON file that changes with every update. `$env:LOCALAPPDATA\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState\start2.bin`, and it's changed with every update; * Take a look at https://gist.github.com/rad1ke/d8c4121931633eca04ca625d09ff1a11#file-windows-11-setup-ps1-L42 if you're interested in the function. * Fixed `Cursors` function; - * Please re-run it by using `. .\Functions.ps1` module + * Please re-run it by using `. .\Import-TabCompletion.ps1` module * Added a warning for `Set-Association` function: `.pdf` and `http/https` protocols will be skipped; * Microsoft has blocked write access to UserChoice key for .pdf extention and http/https protocols with KB5034765 and KB5034763 for Windows 11 and Windows 10 respectively. * `RKNBypass` updated; @@ -341,7 +341,7 @@ With best wishes for a happy New Year from `Team Sophia` ![img](https://forum.ru * The `InitialActions` function simplified; * Fixed bug in `TempTask` when `$env:SystemDrive\Recovery` folder wasn't removed; - * Just in case re-create `Temp` scheduled task via `. .\Functions.ps1` [method](https://github.com/farag2/Sophia-Script-for-Windows#how-to-run-the-specific-functions). + * Just in case re-create `Temp` scheduled task via `. .\Import-TabCompletion.ps1` [method](https://github.com/farag2/Sophia-Script-for-Windows#how-to-run-the-specific-functions). * Thanks to `linchel23`. * Added `CopilotButton` function for `Windows 10` to hide ot show Copilot button on the taskbar as Windows starts supporting it with the latest available build; * Added `WindowsLatestUpdate` function for `Windows 10` to let user get Windows updates as soon as they're available for your device as Windows starts supporting it with the latest available build; @@ -531,7 +531,7 @@ Thanks to frost_tg for bug reporting ```powershell # With dot at the beginning - . .\Functions.ps1 + . .\Import-TabCompletion.ps1 Sophia -Functions "CleanupTask -Register", "SoftwareDistributionTask -Register", "TempTask -Register" ``` @@ -1462,8 +1462,8 @@ Diff from v5.9 * Calling the specific function was completely rewritten! :rocket: * Added the Tab functions autocompletion by typing its' first letters https://user-images.githubusercontent.com/10544660/225270281-908abad1-d125-4cae-a19b-2cf80d5d2751.mp4 - * The code from moved to the `Functions.ps1` file; - * If you want to call the specific function you need to [dot source](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator-) the `Functions.ps1` first + * The code from moved to the `Import-TabCompletion.ps1` file; + * If you want to call the specific function you need to [dot source](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator-) the `Import-TabCompletion.ps1` first ```powershell # With a dot at the beginning diff --git a/README.md b/README.md index c647758f..05854369 100644 --- a/README.md +++ b/README.md @@ -133,11 +133,11 @@ choco install sophia --params "/PS7" --force -y ### How to run the specific function(s) * Do all steps from [Manual method](#manual-method) section and stop at setting execution policy in `PowerShell`; -* [Dot source](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator) the `Functions.ps1` file first: +* [Dot source](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator) the `Import-TabCompletion.ps1` file first: ```powershell # With a dot at the beginning -. .\Functions.ps1 +. .\Import-TabCompletion.ps1 ``` * Now you can do like this (the quotation marks required) @@ -203,7 +203,7 @@ Or use an old-style format without the TAB functions autocomplete (th * Set up UI & Personalization; * Uninstall OneDrive "correctly"; * Interactive [prompts](#change-user-folders-location-programmatically-using-the-interactive-menu); -* The TAB [completion](#the-tab-autocomplete-read-more-here) for functions and their arguments (if using the Functions.ps1 file); +* The TAB [completion](#the-tab-autocomplete-read-more-here) for functions and their arguments (if using the Import-TabCompletion.ps1 file); * Change location of the user folders programmatically (without moving user files) within interactive menu using arrows to select a drive * Desktop * Documents @@ -270,7 +270,7 @@ https://user-images.githubusercontent.com/10544660/253818031-b7ce6bf1-d968-41ea- * Get your OS UI culture by invoking `$PSUICulture` in PowerShell; * Create a folder with the UI culture name; -* Place your localized Sophia.psd1 file into this folder. +* Place your localized SophiaScript.psd1 file into this folder. ## Media diff --git a/Scripts/ReleaseNotesTemplate.ps1 b/Scripts/ReleaseNotesTemplate.ps1 new file mode 100644 index 00000000..42cd1feb --- /dev/null +++ b/Scripts/ReleaseNotesTemplate.ps1 @@ -0,0 +1,42 @@ +# Get a penultimate build tag +$Headers = @{ + Accept = "application/vnd.github+json" + Authorization = "Bearer $env:GITHUB_TOKEN" +} +$Parameters = @{ + Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases" + Headers = $Headers + UseBasicParsing = $true + Verbose = $true +} +$Penultimate = (Invoke-RestMethod @Parameters).tag_name | Select-Object -Index 1 + +# Parse json for the latest script versions +$Parameters = @{ + Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" + UseBasicParsing = $true + Verbose = $true +} +$JSON = Invoke-RestMethod @Parameters + +# Replace variables with script latest versions +# No need to replace special characters with percent-encoding ones +(Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw) | Foreach-Object -Process { + # ${{ github.ref_name }} + $_ -replace "NewVersion", $env:GITHUB_REF_NAME ` + -replace "OldVersion", $Penultimate ` + -replace "Sophia_Script_Windows_10_PowerShell_5_1", $JSON.Sophia_Script_Windows_10_PowerShell_5_1 ` + -replace "Sophia_Script_Windows_10_PowerShell_7", $JSON.Sophia_Script_Windows_10_PowerShell_7 ` + -replace "Sophia_Script_Windows_10_LTSC2019", $JSON.Sophia_Script_Windows_10_LTSC2019 ` + -replace "Sophia_Script_Windows_10_LTSC2021", $JSON.Sophia_Script_Windows_10_LTSC2021 ` + -replace "Sophia_Script_Windows_11_PowerShell_5_1", $JSON.Sophia_Script_Windows_11_PowerShell_5_1 ` + -replace "Sophia_Script_Windows_11_PowerShell_7", $JSON.Sophia_Script_Windows_11_PowerShell_7 ` + -replace "Sophia_Script_Windows_11_LTSC2024", $JSON.Sophia_Script_Windows_11_LTSC2024 ` + -replace "Sophia_Script_Wrapper", $JSON.Sophia_Script_Wrapper +} | Set-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Force + +# https://trstringer.com/github-actions-multiline-strings/ +Add-Content -Path $env:GITHUB_OUTPUT -Value "ReleaseBody=ReleaseNotesTemplate.md" + +$ReleaseName = Get-Date -f "dd.MM.yyyy" +echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV diff --git a/Scripts/Windows_10.ps1 b/Scripts/Windows_10.ps1 index 783af66c..4ee21e97 100644 --- a/Scripts/Windows_10.ps1 +++ b/Scripts/Windows_10.ps1 @@ -2,31 +2,26 @@ $Parameters = @{ 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 +$Latest_Release_Windows_10_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1 -Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Verbose +Write-Verbose -Message "Sophia.Script.for.Windows.10.v$Latest_Release_Windows_10_PowerShell_5_1.zip" -Verbose -New-Item -Path "Sophia_Script_for_Windows_10_v$LatestRelease\Binaries" -ItemType Directory -Force +New-Item -Path "Sophia_Script_for_Windows_10_v$Latest_Release_Windows_10_PowerShell_5_1\Binaries" -ItemType Directory -Force $Parameters = @{ Path = @("Scripts\LGPO.exe") - Destination = "Sophia_Script_for_Windows_10_v$LatestRelease\Binaries" + Destination = "Sophia_Script_for_Windows_10_v$Latest_Release_Windows_10_PowerShell_5_1\Binaries" 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 +Get-ChildItem -Path "src\Sophia_Script_for_Windows_10" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_v$Latest_Release_Windows_10_PowerShell_5_1" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_for_Windows_10_v$LatestRelease" - DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.zip" + Path = "Sophia_Script_for_Windows_10_v$Latest_Release_Windows_10_PowerShell_5_1" + DestinationPath = "Sophia.Script.for.Windows.10.v$Latest_Release_Windows_10_PowerShell_5_1.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)" -} | Add-Content -Path SHA256SUM -Encoding utf8 -Force diff --git a/Scripts/Windows_10_LTSC_2019.ps1 b/Scripts/Windows_10_LTSC_2019.ps1 index 53441e5d..5b058e7e 100644 --- a/Scripts/Windows_10_LTSC_2019.ps1 +++ b/Scripts/Windows_10_LTSC_2019.ps1 @@ -2,31 +2,26 @@ $Parameters = @{ Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" } -$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019 +$Latest_Release_Windows_10_LTSC2019 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019 -Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Verbose +Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2019.v$Latest_Release_Windows_10_LTSC2019.zip" -Verbose -New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\Binaries" -ItemType Directory -Force +New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2019_v$Latest_Release_Windows_10_LTSC2019\Binaries" -ItemType Directory -Force $Parameters = @{ Path = @("Scripts\LGPO.exe") - Destination = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\Binaries" + Destination = "Sophia_Script_for_Windows_10_LTSC_2019_v$Latest_Release_Windows_10_LTSC2019\Binaries" 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 +Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_LTSC_2019" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_LTSC_2019_v$Latest_Release_Windows_10_LTSC2019" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease" - DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" + Path = "Sophia_Script_for_Windows_10_LTSC_2019_v$Latest_Release_Windows_10_LTSC2019" + DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$Latest_Release_Windows_10_LTSC2019.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)" -} | Add-Content -Path SHA256SUM -Encoding utf8 -Force diff --git a/Scripts/Windows_10_LTSC_2021.ps1 b/Scripts/Windows_10_LTSC_2021.ps1 index 97588cd7..ca0158e3 100644 --- a/Scripts/Windows_10_LTSC_2021.ps1 +++ b/Scripts/Windows_10_LTSC_2021.ps1 @@ -2,31 +2,26 @@ $Parameters = @{ Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" } -$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021 +$Latest_Release_Windows_10_LTSC2021 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021 -Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" -Verbose +Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2021.v$Latest_Release_Windows_10_LTSC2021.zip" -Verbose -New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\Binaries" -ItemType Directory -Force +New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2021_v$Latest_Release_Windows_10_LTSC2021\Binaries" -ItemType Directory -Force $Parameters = @{ Path = @("Scripts\LGPO.exe") - Destination = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\Binaries" + Destination = "Sophia_Script_for_Windows_10_LTSC_2021_v$Latest_Release_Windows_10_LTSC2021\Binaries" 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 +Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_LTSC_2021" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_LTSC_2021_v$Latest_Release_Windows_10_LTSC2021" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease" - DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" + Path = "Sophia_Script_for_Windows_10_LTSC_2021_v$Latest_Release_Windows_10_LTSC2021" + DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2021.v$Latest_Release_Windows_10_LTSC2021.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)" -} | Add-Content -Path SHA256SUM -Encoding utf8 -Force diff --git a/Scripts/Windows_10_PS_7.ps1 b/Scripts/Windows_10_PS_7.ps1 index d3c4f071..bddd218b 100644 --- a/Scripts/Windows_10_PS_7.ps1 +++ b/Scripts/Windows_10_PS_7.ps1 @@ -2,31 +2,26 @@ $Parameters = @{ 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 +$Latest_Release_Windows_10_PowerShell_7 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7 -Write-Verbose -Message "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" -Verbose +Write-Verbose -Message "Sophia.Script.for.Windows.10.PowerShell.7.v$Latest_Release_Windows_10_PowerShell_7.zip" -Verbose -New-Item -Path "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\Binaries" -ItemType Directory -Force +New-Item -Path "Sophia_Script_for_Windows_10_PowerShell_7_v$Latest_Release_Windows_10_PowerShell_7\Binaries" -ItemType Directory -Force $Parameters = @{ Path = @("Scripts\LGPO.exe", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll") - Destination = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\Binaries" + Destination = "Sophia_Script_for_Windows_10_PowerShell_7_v$Latest_Release_Windows_10_PowerShell_7\Binaries" 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 +Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_PowerShell_7" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_PowerShell_7_v$Latest_Release_Windows_10_PowerShell_7" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease" - DestinationPath = "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" + Path = "Sophia_Script_for_Windows_10_PowerShell_7_v$Latest_Release_Windows_10_PowerShell_7" + DestinationPath = "Sophia.Script.for.Windows.10.PowerShell.7.v$Latest_Release_Windows_10_PowerShell_7.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)" -} | Add-Content -Path SHA256SUM -Encoding utf8 -Force diff --git a/Scripts/Windows_11.ps1 b/Scripts/Windows_11.ps1 index 53ee0965..1e7a1079 100644 --- a/Scripts/Windows_11.ps1 +++ b/Scripts/Windows_11.ps1 @@ -2,31 +2,26 @@ $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 +$Latest_Release_Windows_11_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 -Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbose +Write-Verbose -Message "Sophia.Script.for.Windows.11.v$Latest_Release_Windows_11_PowerShell_5_1.zip" -Verbose -New-Item -Path "Sophia_Script_for_Windows_11_v$LatestRelease\Binaries" -ItemType Directory -Force +New-Item -Path "Sophia_Script_for_Windows_11_v$Latest_Release_Windows_11_PowerShell_5_1\Binaries" -ItemType Directory -Force $Parameters = @{ Path = @("Scripts\LGPO.exe") - Destination = "Sophia_Script_for_Windows_11_v$LatestRelease\Binaries" + Destination = "Sophia_Script_for_Windows_11_v$Latest_Release_Windows_11_PowerShell_5_1\Binaries" 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 +Get-ChildItem -Path "src\Sophia_Script_for_Windows_11" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_11_v$Latest_Release_Windows_11_PowerShell_5_1" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_for_Windows_11_v$LatestRelease" - DestinationPath = "Sophia.Script.for.Windows.11.v$LatestRelease.zip" + Path = "Sophia_Script_for_Windows_11_v$Latest_Release_Windows_11_PowerShell_5_1" + DestinationPath = "Sophia.Script.for.Windows.11.v$Latest_Release_Windows_11_PowerShell_5_1.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 diff --git a/Scripts/Windows_11_LTSC_2024.ps1 b/Scripts/Windows_11_LTSC_2024.ps1 index b2468b67..d334d8a3 100644 --- a/Scripts/Windows_11_LTSC_2024.ps1 +++ b/Scripts/Windows_11_LTSC_2024.ps1 @@ -2,31 +2,26 @@ $Parameters = @{ Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" } -$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024 +$Latest_Release_Windows_11_LTSC2024 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024 -Write-Verbose -Message "Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip" -Verbose +Write-Verbose -Message "Sophia.Script.for.Windows.11.LTSC.2024.v$Latest_Release_Windows_11_LTSC2024.zip" -Verbose -New-Item -Path "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease\Binaries" -ItemType Directory -Force +New-Item -Path "Sophia_Script_for_Windows_11_LTSC_2024_v$Latest_Release_Windows_11_LTSC2024\Binaries" -ItemType Directory -Force $Parameters = @{ Path = @("Scripts\LGPO.exe") - Destination = "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease\Binaries" + Destination = "Sophia_Script_for_Windows_11_LTSC_2024_v$Latest_Release_Windows_11_LTSC2024\Binaries" Recurse = $true Force = $true } Copy-Item @Parameters -Get-ChildItem -Path "src\Sophia_Script_for_Windows_11_LTSC_2024" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease" -Recurse -Force +Get-ChildItem -Path "src\Sophia_Script_for_Windows_11_LTSC_2024" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_11_LTSC_2024_v$Latest_Release_Windows_11_LTSC2024" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease" - DestinationPath = "Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip" + Path = "Sophia_Script_for_Windows_11_LTSC_2024_v$Latest_Release_Windows_11_LTSC2024" + DestinationPath = "Sophia.Script.for.Windows.11.LTSC.2024.v$Latest_Release_Windows_11_LTSC2024.zip" CompressionLevel = "Fastest" Force = $true } Compress-Archive @Parameters - -# Calculate hash -Get-Item -Path "Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip" -Force | ForEach-Object -Process { - "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" -} | Add-Content -Path SHA256SUM -Encoding utf8 -Force diff --git a/Scripts/Windows_11_PS_7.ps1 b/Scripts/Windows_11_PS_7.ps1 index a6cb7d15..1847689a 100644 --- a/Scripts/Windows_11_PS_7.ps1 +++ b/Scripts/Windows_11_PS_7.ps1 @@ -2,31 +2,26 @@ $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_7 +$Latest_Release_Windows_11_PowerShell_7 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7 -Write-Verbose -Message "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" -Verbose +Write-Verbose -Message "Sophia.Script.for.Windows.11.PowerShell.7.v$Latest_Release_Windows_11_PowerShell_7.zip" -Verbose -New-Item -Path "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\Binaries" -ItemType Directory -Force +New-Item -Path "Sophia_Script_for_Windows_11_PowerShell_7_v$Latest_Release_Windows_11_PowerShell_7\Binaries" -ItemType Directory -Force $Parameters = @{ Path = @("Scripts\LGPO.exe", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll") - Destination = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\Binaries" + Destination = "Sophia_Script_for_Windows_11_PowerShell_7_v$Latest_Release_Windows_11_PowerShell_7\Binaries" 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 +Get-ChildItem -Path "src\Sophia_Script_for_Windows_11_PowerShell_7" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_11_PowerShell_7_v$Latest_Release_Windows_11_PowerShell_7" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease" - DestinationPath = "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" + Path = "Sophia_Script_for_Windows_11_PowerShell_7_v$Latest_Release_Windows_11_PowerShell_7" + DestinationPath = "Sophia.Script.for.Windows.11.PowerShell.7.v$Latest_Release_Windows_11_PowerShell_7.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)" -} | Add-Content -Path SHA256SUM -Encoding utf8 -Force diff --git a/Scripts/Wrapper.ps1 b/Scripts/Wrapper.ps1 index db504a68..8f7b7f4d 100644 --- a/Scripts/Wrapper.ps1 +++ b/Scripts/Wrapper.ps1 @@ -1,24 +1,18 @@ # 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" } +$Latest_Release_Sophia_Script_Wrapper = (Invoke-RestMethod @Parameters).Sophia_Script_Wrapper -$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Wrapper +Write-Verbose -Message "Sophia.Script.Wrapper.v$Latest_Release_Sophia_Script_Wrapper.zip" -Verbose -Write-Verbose -Message "Sophia.Script.Wrapper.v$LatestRelease.zip" -Verbose +New-Item -Path "Sophia_Script_Wrapper_v$Latest_Release_Sophia_Script_Wrapper" -ItemType Directory -Force -New-Item -Path "Sophia_Script_Wrapper_v$LatestRelease" -ItemType Directory -Force - -Get-ChildItem -Path Wrapper -Exclude README.md -Force | Copy-Item -Destination "Sophia_Script_Wrapper_v$LatestRelease" -Recurse -Force +Get-ChildItem -Path Wrapper -Exclude README.md -Force | Copy-Item -Destination "Sophia_Script_Wrapper_v$Latest_Release_Sophia_Script_Wrapper" -Recurse -Force $Parameters = @{ - Path = "Sophia_Script_Wrapper_v$LatestRelease" - DestinationPath = "Sophia.Script.Wrapper.v$LatestRelease.zip" - CompressionLevel = "Fastest" - Force = $true + Path = "Sophia_Script_Wrapper_v$Latest_Release_Sophia_Script_Wrapper" + DestinationPath = "Sophia.Script.Wrapper.v$Latest_Release_Sophia_Script_Wrapper.zip" + CompressionLevel = "Fastest" + Force = $true } Compress-Archive @Parameters - -# Calculate hash -Get-Item -Path "Sophia.Script.Wrapper.v$LatestRelease.zip" -Force | ForEach-Object -Process { - "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" -} | Add-Content -Path SHA256SUM -Encoding utf8 -Force diff --git a/chocolatey/sophia.nuspec b/chocolatey/sophia.nuspec index 8a963e3d..f1eda4b5 100644 --- a/chocolatey/sophia.nuspec +++ b/chocolatey/sophia.nuspec @@ -3,8 +3,8 @@ sophia - 6.8.3 - https://github.com/farag2/Sophia-Script-for-Windows + 6.8.4.2 + https://github.com/farag2/Sophia-Script-for-Windows/tree/master/chocolatey Team Sophia Sophia Script for Windows Team Sophia diff --git a/chocolatey/tools/chocolateyinstall.ps1 b/chocolatey/tools/chocolateyinstall.ps1 index 59568660..a048bc3a 100644 --- a/chocolatey/tools/chocolateyinstall.ps1 +++ b/chocolatey/tools/chocolateyinstall.ps1 @@ -19,25 +19,6 @@ $Parameters = @{ } $LatestGitHubRelease = (Invoke-RestMethod @Parameters).tag_name -if (-not $LatestGitHubRelease) -{ - Write-Warning -Message "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases/latest is unreachable. Please fix connection or change your DNS records." - Write-Information -MessageData "" -InformationAction Continue - - if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) - { - $DNS = (Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Get-DnsClientServerAddress -AddressFamily IPv4).ServerAddresses - } - else - { - $DNS = (Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Get-DnsClientServerAddress -AddressFamily IPv4).ServerAddresses - } - Write-Warning -Message "Your DNS are $(if ($DNS.Count -gt 1) {$DNS -join ', '} else {$DNS})" - - pause - exit -} - $Parameters = @{ Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" UseBasicParsing = $true @@ -56,7 +37,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) { $LatestRelease = $JSONVersions.Sophia_Script_Windows_10_LTSC2019 $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" - $Hash = "BFB0554FD186B52A391B4067F3186BCCD047C54C4A32D31DEE4D7891B04C2446" + $Hash = "Hash_Sophia_Script_Windows_10_LTSC2019" } else { @@ -82,7 +63,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) { $LatestRelease = $JSONVersions.Sophia_Script_Windows_10_LTSC2021 $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" - $hash = "9D73A8F5CDDA53BFBBF1DF7B9D503436DBDA205491EF71D174ED95931036D01E" + $Hash = "Hash_Sophia_Script_Windows_10_LTSC2021" } else { @@ -107,20 +88,28 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) { if ($packageParameters.Contains('PS7')) { - $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7 + $LatestRelease = $JSONVersions.Sophia_Script_Windows_10_PowerShell_7 $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" + $Hash = "Hash_Sophia_Script_Windows_10_PowerShell_7" } } else { $LatestRelease = $JSONVersions.Sophia_Script_Windows_10_PowerShell_5_1 $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.v$LatestRelease.zip" + $Hash = "Hash_Sophia_Script_Windows_10_PowerShell_5_1" } } {$_ -ge 26100} { # Check for Windows 11 LTSC 2024 - if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -notmatch "LTSC 2024") + if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -match "LTSC 2024") + { + $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_LTSC2024 + $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip" + $Hash = "Hash_Sophia_Script_Windows_11_LTSC2024" + } + else { if ($packageParameters) { @@ -128,29 +117,23 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) { $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_7 $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" - + $Hash = "Hash_Sophia_Script_Windows_11_PowerShell_7" } } else { $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_5_1 $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip" - + $Hash = "Hash_Sophia_Script_Windows_11_PowerShell_5_1" } } - else - { - $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_LTSC2024 - $URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip" - } } } -# Downloads folder $Downloads = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" -$Hash = (Get-FileHash -InputStream (Invoke-WebRequest -Uri $URL -UseBasicParsing).RawContentStream -Algorithm SHA256).Hash $packageArgs = @{ packageName = $env:ChocolateyPackageName + fileType = "ZIP" unzipLocation = $Downloads url = $URL checksum = $Hash diff --git a/docs/README_de-de.md b/docs/README_de-de.md index fa133598..1454b129 100644 --- a/docs/README_de-de.md +++ b/docs/README_de-de.md @@ -133,11 +133,11 @@ choco install sophia --params "/PS7" --force -y ### Verwendung von spezifischen Funktionen * Führen Sie alle Schritte aus dem Abschnitt [Manuelle Methode](#manuelle-methode) aus und stoppen Sie bei den Einstellungen der Ausführungsrichtlinie in PowerShell. -* Um spezifische Funktionen auszuführen [dot source](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator) die `Functions.ps1` datei zuerst: +* Um spezifische Funktionen auszuführen [dot source](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator) die `Import-TabCompletion.ps1` datei zuerst: ```powershell # With a dot at the beginning -. .\Functions.ps1 +. .\Import-TabCompletion.ps1 ``` * Jetzt können Sie dies tun (die Anführungszeichen sind erforderlich) @@ -203,7 +203,7 @@ Oder verwenden Sie ein Format im alten Stil ohne die TAB-Funktionen z * UI & Personalisierung einrichten; * OneDrive "richtig" deinstallieren; * Interaktive [Eingabeaufforderungen](#change-user-folders-location-programmatically-using-the-interactive-menu); -* Die TAB [Autovervollständigung](#the-tab-autocomplete-read-more-here) für Funktionen und ihre Argumente (bei Verwendung der Datei Functions.ps1); +* Die TAB [Autovervollständigung](#the-tab-autocomplete-read-more-here) für Funktionen und ihre Argumente (bei Verwendung der Datei Import-TabCompletion.ps1); * Ändern Sie den Speicherort der Benutzerordner programmatisch (ohne die Benutzerdateien zu verschieben) im interaktiven Menü mit Hilfe von Pfeilen zur Auswahl eines Laufwerks * Desktop * Dokumente @@ -267,7 +267,7 @@ https://user-images.githubusercontent.com/10544660/253818031-b7ce6bf1-d968-41ea- * Holen Sie sich die Sprache der Benutzeroberfläche Ihres Betriebssystems, indem Sie "$PSUICulture" in PowerShell aufrufen; * Erstellen Sie einen Ordner mit dem Namen der UI-Sprache; -* Legen Sie Ihre lokalisierte Sophia.psd1-Datei in diesen Ordner. +* Legen Sie Ihre lokalisierte SophiaScript.psd1-Datei in diesen Ordner. ## Media diff --git a/docs/README_ru-ru.md b/docs/README_ru-ru.md index 1248f955..e69fb0a9 100644 --- a/docs/README_ru-ru.md +++ b/docs/README_ru-ru.md @@ -133,11 +133,11 @@ choco install sophia --params "/PS7" --force -y ### Как выполните конкретную функцию(и) * Выполните все шаги из пукнта [Вручную](#вручную) и остановитесь на пункте по изменнию политики выполнения скриптов в `PowerShell`; -* Сначала загрузите файл `Functions.ps1` через [дот сорсинг](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator): +* Сначала загрузите файл `Import-TabCompletion.ps1` через [дот сорсинг](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator): ```powershell # С точкой в начале -. .\Functions.ps1 +. .\Import-TabCompletion.ps1 ``` * Теперь вы можете выполнять такие команды (необходимы кавычки) @@ -203,7 +203,7 @@ UninstallUWPApps, "PinToStart -UnpinAll" * Настроить UI и персонализацию; * "Правильно" удалить OneDrive; * Интерактивные [подсказки](#программно-изменить-расположение-пользовательских-папок-с-помощью-интерактивного-меню); -* [Автопродление](#автопродление-функций-с-помощью-tab-подробнее-здесь) функций и их аргументов с помощью TAB (при условии использования файла Functions.ps1); +* [Автопродление](#автопродление-функций-с-помощью-tab-подробнее-здесь) функций и их аргументов с помощью TAB (при условии использования файла Import-TabCompletion.ps1); * Программно изменить расположение пользовательских папок с помощью интерактивного меню (без перемещения пользовательских файлов), используя стрелки для выбора диска * Рабочий стол * Документы @@ -267,7 +267,7 @@ https://user-images.githubusercontent.com/10544660/253818031-b7ce6bf1-d968-41ea- * Выполните команду `$PSUICulture` в PowerShell, чтобы узнать код культуры; * Создайте папку с названием вашей культуры; -* Поместите ваш переведенный файл Sophia.psd1 в эту папку. +* Поместите ваш переведенный файл SophiaScript.psd1 в эту папку. ## Ссылки diff --git a/docs/README_uk-ua.md b/docs/README_uk-ua.md index 3200d365..4a670b42 100644 --- a/docs/README_uk-ua.md +++ b/docs/README_uk-ua.md @@ -133,11 +133,11 @@ choco install sophia --params "/PS7" --force -y ### Як запустити певну функцію(ї) * Повторіть усі кроки з розділу [Вручну](#вручну) і зупиніться на кроці встановлення політики виконання скриптів у `PowerShell`; -* Для запуску певної функції(й) [запустити](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator) необхідно запустити файл `Functions.ps1`: +* Для запуску певної функції(й) [запустити](https://docs.microsoft.com/ru-ru/powershell/module/microsoft.powershell.core/about/about_operators#dot-sourcing-operator) необхідно запустити файл `Import-TabCompletion.ps1`: ```powershell # З крапкою на початку -. .\Functions.ps1 +. .\Import-TabCompletion.ps1 ``` * Тепер можна зробити так (лапки обов'язкові) @@ -203,7 +203,7 @@ UninstallUWPApps, "PinToStart -UnpinAll" * Налаштування інтерфейсу і персоналізація; * "Правильне" видалення OneDrive; * Інтерактивні [підказки](#програмна-зміна-розташування-папок-користувача-за-допомогою-інтерактивного-меню); -* TAB [доповнення](#автодоповнення-tab-детальніше-тут) для функцій та їх аргументів (якщо використовується файл Functions.ps1); +* TAB [доповнення](#автодоповнення-tab-детальніше-тут) для функцій та їх аргументів (якщо використовується файл Import-TabCompletion.ps1); * Зміна розташування користувацьких папок програмно (без переміщення користувацьких файлів) в інтерактивному меню за допомогою стрілок для вибору диска * Робочий стіл * Документи @@ -267,7 +267,7 @@ https://user-images.githubusercontent.com/10544660/253818031-b7ce6bf1-d968-41ea- * Дізнайтеся мову інтерфейсу Вашої ОС, викликавши `$PSUICulture` в PowerShell; * Створіть папку з назвою Вашої мови інтерфейсу; -* Помістіть ваш локалізований файл Sophia.psd1 в цю папку. +* Помістіть ваш локалізований файл SophiaScript.psd1 в цю папку. ## Медіа diff --git a/src/Sophia_Script_for_Windows_10/Functions.ps1 b/src/Sophia_Script_for_Windows_10/Import-TabCompletion.ps1 similarity index 96% rename from src/Sophia_Script_for_Windows_10/Functions.ps1 rename to src/Sophia_Script_for_Windows_10/Import-TabCompletion.ps1 index 18e87d4f..4ec8e695 100644 --- a/src/Sophia_Script_for_Windows_10/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_10/Import-TabCompletion.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - The TAB completion for functions and their arguments + Enable tab completion to invoke for functions if you do not know function name Version: 5.20.4 Date: 05.04.2025 @@ -10,7 +10,7 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Dot source the script first: . .\Import-TabCompletion.ps1 (with a dot at the beginning) Start typing any characters contained in the function's name or its arguments, and press the TAB button .EXAMPLE @@ -51,8 +51,8 @@ Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.20.4 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" -Remove-Module -Name Sophia -Force -ErrorAction Ignore -Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore +Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia -BaseDirectory $PSScriptRoot\Localizations @@ -73,7 +73,7 @@ $Parameters = @{ ) # Get functions list with arguments to complete - $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys + $Commands = (Get-Module -Name SophiaScript).ExportedCommands.Keys foreach ($Command in $Commands) { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} diff --git a/src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Manifest/SophiaScript.psd1 similarity index 100% rename from src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1 rename to src/Sophia_Script_for_Windows_10/Manifest/SophiaScript.psd1 diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index f40bd8a5..e7cd8dfb 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -573,7 +573,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Checking wdFilter service try { - if (Get-Service -Name wdFilter -ErrorAction Stop) + if (-not (Get-Service -Name wdFilter -ErrorAction Stop)) { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") @@ -727,7 +727,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); UseBasicParsing = $true } $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1 - $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() + $CurrentRelease = (Get-Module -Name SophiaScript).Version.ToString() if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { @@ -4958,7 +4958,7 @@ function Cursors "%SystemRoot%\Cursors\W11 Cursor Light Free\arrow.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\help.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\appstarting.ani", - "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani",, + "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani", "%SystemRoot%\Cursors\W11 Cursor Light Free\crosshair.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\ibeam.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\nwpen.cur", @@ -7818,15 +7818,15 @@ function WinPrtScrFolder return } - # Checking how the script was invoked: via a preset or Functions.ps1 + # Checking how the script was invoked: via a preset or Import-TabCompletion.ps1 # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-variable # This function works only if OneDrive was already uninstalled, or user is intended to uninstall "OneDrive -Uninstall" within commandline $PresetName = (Get-Variable -Name MyInvocation -Scope Script).Value.PSCommandPath $PSCallStack = (Get-PSCallStack).Position.Text $OneDriveInstalled = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore - # Checking whether function was called from Functions.ps1 - if ($PresetName -match "Functions.ps1") + # Checking whether function was called from Import-TabCompletion.ps1 + if ($PresetName -match "Import-TabCompletion.ps1") { # Checking whether command contains "WinPrtScrFolder -Desktop" if ($PSCallStack -match "WinPrtScrFolder -Desktop") diff --git a/src/Sophia_Script_for_Windows_10/Sophia.ps1 b/src/Sophia_Script_for_Windows_10/Sophia.ps1 index aa68bdf7..e20a8d1d 100644 --- a/src/Sophia_Script_for_Windows_10/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10/Sophia.ps1 @@ -38,8 +38,8 @@ Architecture: x64 .NOTES - To use the TAB completion for functions and their arguments dot source the Functions.ps1 script first: - . .\Function.ps1 (with a dot at the beginning) + To use Enable tab completion to invoke for functions if you do not know function name dot source the Import-TabCompletion.ps1 script first: + . .\Import-TabCompletion.ps1 (with a dot at the beginning) Read more at https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-run-the-specific-functions .LINK GitHub @@ -94,7 +94,7 @@ $ScriptFiles = @( "$PSScriptRoot\Localizations\uk-UA\Sophia.psd1", "$PSScriptRoot\Localizations\zh-CN\Sophia.psd1", "$PSScriptRoot\Module\Sophia.psm1", - "$PSScriptRoot\Manifest\Sophia.psd1" + "$PSScriptRoot\Manifest\SophiaScript.psd1" ) if (($ScriptFiles | Test-Path) -contains $false) { @@ -108,7 +108,7 @@ if (($ScriptFiles | Test-Path) -contains $false) exit } -Remove-Module -Name Sophia -Force -ErrorAction Ignore +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore try { Import-LocalizedData -BindingVariable Global:Localization -UICulture $PSUICulture -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia -ErrorAction Stop @@ -121,7 +121,7 @@ catch # Checking whether script is the correct PowerShell version try { - Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force -ErrorAction Stop + Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force -ErrorAction Stop } catch [System.InvalidOperationException] { diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Import-TabCompletion.ps1 similarity index 93% rename from src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 rename to src/Sophia_Script_for_Windows_10_LTSC_2019/Import-TabCompletion.ps1 index 963b2943..2be012ff 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Import-TabCompletion.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - The TAB completion for functions and their arguments + Enable tab completion to invoke for functions if you do not know function name Version: 5.10.4 Date: 05.04.2025 @@ -10,7 +10,7 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Dot source the script first: . .\Import-TabCompletion.ps1 (with a dot at the beginning) Start typing any characters contained in the function's name or its arguments, and press the TAB button .EXAMPLE @@ -51,8 +51,8 @@ Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.10.4 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" -Remove-Module -Name Sophia -Force -ErrorAction Ignore -Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore +Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia -BaseDirectory $PSScriptRoot\Localizations @@ -73,7 +73,7 @@ $Parameters = @{ ) # Get functions list with arguments to complete - $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys + $Commands = (Get-Module -Name SophiaScript).ExportedCommands.Keys foreach ($Command in $Commands) { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/SophiaScript.psd1 similarity index 100% rename from src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1 rename to src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/SophiaScript.psd1 diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 index 1648de53..94da8188 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 @@ -545,7 +545,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Checking wdFilter service try { - if (Get-Service -Name wdFilter -ErrorAction Stop) + if (-not (Get-Service -Name wdFilter -ErrorAction Stop)) { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") @@ -688,7 +688,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); UseBasicParsing = $true } $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019 - $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() + $CurrentRelease = (Get-Module -Name SophiaScript).Version.ToString() if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { @@ -3920,7 +3920,7 @@ function Cursors "%SystemRoot%\Cursors\W11 Cursor Light Free\arrow.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\help.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\appstarting.ani", - "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani",, + "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani", "%SystemRoot%\Cursors\W11 Cursor Light Free\crosshair.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\ibeam.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\nwpen.cur", diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 index bf72a3b4..5b5f424d 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 @@ -36,8 +36,8 @@ Architecture: x64 .NOTES - To use the TAB completion for functions and their arguments dot source the Functions.ps1 script first: - . .\Function.ps1 (with a dot at the beginning) + To use Enable tab completion to invoke for functions if you do not know function name dot source the Import-TabCompletion.ps1 script first: + . .\Import-TabCompletion.ps1 (with a dot at the beginning) Read more at https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-run-the-specific-functions .LINK GitHub @@ -92,7 +92,7 @@ $ScriptFiles = @( "$PSScriptRoot\Localizations\uk-UA\Sophia.psd1", "$PSScriptRoot\Localizations\zh-CN\Sophia.psd1", "$PSScriptRoot\Module\Sophia.psm1", - "$PSScriptRoot\Manifest\Sophia.psd1" + "$PSScriptRoot\Manifest\SophiaScript.psd1" ) if (($ScriptFiles | Test-Path) -contains $false) { @@ -106,7 +106,7 @@ if (($ScriptFiles | Test-Path) -contains $false) exit } -Remove-Module -Name Sophia -Force -ErrorAction Ignore +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore try { Import-LocalizedData -BindingVariable Global:Localization -UICulture $PSUICulture -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia -ErrorAction Stop @@ -119,7 +119,7 @@ catch # Checking whether script is the correct PowerShell version try { - Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force -ErrorAction Stop + Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force -ErrorAction Stop } catch [System.InvalidOperationException] { diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Import-TabCompletion.ps1 similarity index 94% rename from src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 rename to src/Sophia_Script_for_Windows_10_LTSC_2021/Import-TabCompletion.ps1 index 13fd8849..8a9549ff 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Import-TabCompletion.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - The TAB completion for functions and their arguments + Enable tab completion to invoke for functions if you do not know function name Version: 5.20.4 Date: 05.04.2025 @@ -10,7 +10,7 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Dot source the script first: . .\Import-TabCompletion.ps1 (with a dot at the beginning) Start typing any characters contained in the function's name or its arguments, and press the TAB button .EXAMPLE @@ -51,8 +51,8 @@ Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.20.4 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" -Remove-Module -Name Sophia -Force -ErrorAction Ignore -Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore +Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia -BaseDirectory $PSScriptRoot\Localizations @@ -73,7 +73,7 @@ $Parameters = @{ ) # Get functions list with arguments to complete - $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys + $Commands = (Get-Module -Name SophiaScript).ExportedCommands.Keys foreach ($Command in $Commands) { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/SophiaScript.psd1 similarity index 100% rename from src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1 rename to src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/SophiaScript.psd1 diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 index 7cf68e1f..b9fe1c1f 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 @@ -545,7 +545,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Checking wdFilter service try { - if (Get-Service -Name wdFilter -ErrorAction Stop) + if (-not (Get-Service -Name wdFilter -ErrorAction Stop)) { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") @@ -688,7 +688,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); UseBasicParsing = $true } $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1 - $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() + $CurrentRelease = (Get-Module -Name SophiaScript).Version.ToString() if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { @@ -4300,7 +4300,7 @@ function Cursors "%SystemRoot%\Cursors\W11 Cursor Light Free\arrow.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\help.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\appstarting.ani", - "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani",, + "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani", "%SystemRoot%\Cursors\W11 Cursor Light Free\crosshair.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\ibeam.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\nwpen.cur", diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 index 9258a064..46ee7b27 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 @@ -36,8 +36,8 @@ Architecture: x64 .NOTES - To use the TAB completion for functions and their arguments dot source the Functions.ps1 script first: - . .\Function.ps1 (with a dot at the beginning) + To use Enable tab completion to invoke for functions if you do not know function name dot source the Import-TabCompletion.ps1 script first: + . .\Import-TabCompletion.ps1 (with a dot at the beginning) Read more at https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-run-the-specific-functions .LINK GitHub @@ -92,7 +92,7 @@ $ScriptFiles = @( "$PSScriptRoot\Localizations\uk-UA\Sophia.psd1", "$PSScriptRoot\Localizations\zh-CN\Sophia.psd1", "$PSScriptRoot\Module\Sophia.psm1", - "$PSScriptRoot\Manifest\Sophia.psd1" + "$PSScriptRoot\Manifest\SophiaScript.psd1" ) if (($ScriptFiles | Test-Path) -contains $false) { @@ -106,7 +106,7 @@ if (($ScriptFiles | Test-Path) -contains $false) exit } -Remove-Module -Name Sophia -Force -ErrorAction Ignore +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore try { Import-LocalizedData -BindingVariable Global:Localization -UICulture $PSUICulture -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia -ErrorAction Stop @@ -119,7 +119,7 @@ catch # Checking whether script is the correct PowerShell version try { - Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force -ErrorAction Stop + Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force -ErrorAction Stop } catch [System.InvalidOperationException] { diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Import-TabCompletion.ps1 similarity index 96% rename from src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1 rename to src/Sophia_Script_for_Windows_10_PowerShell_7/Import-TabCompletion.ps1 index f8754a25..0167a568 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Import-TabCompletion.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - The TAB completion for functions and their arguments + Enable tab completion to invoke for functions if you do not know function name Version: 5.20.4 Date: 05.04.2025 @@ -10,7 +10,7 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Dot source the script first: . .\Import-TabCompletion.ps1 (with a dot at the beginning) Start typing any characters contained in the function's name or its arguments, and press the TAB button .EXAMPLE @@ -51,8 +51,8 @@ Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.20.4 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" -Remove-Module -Name Sophia -Force -ErrorAction Ignore -Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore +Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force try { @@ -80,7 +80,7 @@ $Parameters = @{ ) # Get functions list with arguments to complete - $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys + $Commands = (Get-Module -Name SophiaScript).ExportedCommands.Keys foreach ($Command in $Commands) { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/SophiaScript.psd1 similarity index 100% rename from src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1 rename to src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/SophiaScript.psd1 diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 index 2bbd72b7..aa826ae1 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 @@ -600,7 +600,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Checking wdFilter service try { - if (Get-Service -Name wdFilter -ErrorAction Stop) + if (-not (Get-Service -Name wdFilter -ErrorAction Stop)) { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") @@ -754,7 +754,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); UseBasicParsing = $true } $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1 - $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() + $CurrentRelease = (Get-Module -Name SophiaScript).Version.ToString() if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { @@ -4990,7 +4990,7 @@ function Cursors "%SystemRoot%\Cursors\W11 Cursor Light Free\arrow.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\help.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\appstarting.ani", - "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani",, + "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani", "%SystemRoot%\Cursors\W11 Cursor Light Free\crosshair.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\ibeam.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\nwpen.cur", @@ -7852,15 +7852,15 @@ function WinPrtScrFolder return } - # Checking how the script was invoked: via a preset or Functions.ps1 + # Checking how the script was invoked: via a preset or Import-TabCompletion.ps1 # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-variable # This function works only if OneDrive was already uninstalled, or user is intended to uninstall "OneDrive -Uninstall" within commandline $PresetName = (Get-Variable -Name MyInvocation -Scope Script).Value.PSCommandPath $PSCallStack = (Get-PSCallStack).Position.Text $OneDriveInstalled = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore - # Checking whether function was called from Functions.ps1 - if ($PresetName -match "Functions.ps1") + # Checking whether function was called from Import-TabCompletion.ps1 + if ($PresetName -match "Import-TabCompletion.ps1") { # Checking whether command contains "WinPrtScrFolder -Desktop" if ($PSCallStack -match "WinPrtScrFolder -Desktop") diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 index 13198104..bdadcdec 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 @@ -38,8 +38,8 @@ Architecture: x64 .NOTES - To use the TAB completion for functions and their arguments dot source the Functions.ps1 script first: - . .\Function.ps1 (with a dot at the beginning) + To use Enable tab completion to invoke for functions if you do not know function name dot source the Import-TabCompletion.ps1 script first: + . .\Import-TabCompletion.ps1 (with a dot at the beginning) Read more at https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-run-the-specific-functions .LINK GitHub @@ -94,7 +94,7 @@ $ScriptFiles = @( "$PSScriptRoot\Localizations\uk-UA\Sophia.psd1", "$PSScriptRoot\Localizations\zh-CN\Sophia.psd1", "$PSScriptRoot\Module\Sophia.psm1", - "$PSScriptRoot\Manifest\Sophia.psd1" + "$PSScriptRoot\Manifest\SophiaScript.psd1" ) if (($ScriptFiles | Test-Path) -contains $false) { @@ -108,7 +108,7 @@ if (($ScriptFiles | Test-Path) -contains $false) exit } -Remove-Module -Name Sophia -Force -ErrorAction Ignore +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore # PowerShell 7 doesn't load en-us localization automatically if there is no localization folder in user's language which is determined by $PSUICulture # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-localizeddata?view=powershell-7.3 @@ -125,7 +125,7 @@ catch # Checking whether script is the correct PowerShell version try { - Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force -ErrorAction Stop + Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force -ErrorAction Stop } catch [System.InvalidOperationException] { diff --git a/src/Sophia_Script_for_Windows_11/Functions.ps1 b/src/Sophia_Script_for_Windows_11/Import-TabCompletion.ps1 similarity index 95% rename from src/Sophia_Script_for_Windows_11/Functions.ps1 rename to src/Sophia_Script_for_Windows_11/Import-TabCompletion.ps1 index 4b029701..08cee32f 100644 --- a/src/Sophia_Script_for_Windows_11/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_11/Import-TabCompletion.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - The TAB completion for functions and their arguments + Enable tab completion to invoke for functions if you do not know function name Version: 6.8.4 Date: 05.04.2025 @@ -10,7 +10,7 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Dot source the script first: . .\Import-TabCompletion.ps1 (with a dot at the beginning) Start typing any characters contained in the function's name or its arguments, and press the TAB button .EXAMPLE @@ -51,8 +51,8 @@ Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.8.4 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" -Remove-Module -Name Sophia -Force -ErrorAction Ignore -Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore +Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia -BaseDirectory $PSScriptRoot\Localizations @@ -73,7 +73,7 @@ $Parameters = @{ ) # Get functions list with arguments to complete - $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys + $Commands = (Get-Module -Name SophiaScript).ExportedCommands.Keys foreach ($Command in $Commands) { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} diff --git a/src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Manifest/SophiaScript.psd1 similarity index 100% rename from src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1 rename to src/Sophia_Script_for_Windows_11/Manifest/SophiaScript.psd1 diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index ecf9442c..0e3adcef 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -560,7 +560,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Checking wdFilter service try { - if (Get-Service -Name wdFilter -ErrorAction Stop) + if (-not (Get-Service -Name wdFilter -ErrorAction Stop)) { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") @@ -702,7 +702,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); UseBasicParsing = $true } $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 - $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() + $CurrentRelease = (Get-Module -Name SophiaScript).Version.ToString() if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { @@ -4437,7 +4437,7 @@ function Cursors "%SystemRoot%\Cursors\W11 Cursor Light Free\arrow.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\help.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\appstarting.ani", - "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani",, + "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani", "%SystemRoot%\Cursors\W11 Cursor Light Free\crosshair.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\ibeam.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\nwpen.cur", @@ -7600,15 +7600,15 @@ function WinPrtScrFolder return } - # Checking how the script was invoked: via a preset or Functions.ps1 + # Checking how the script was invoked: via a preset or Import-TabCompletion.ps1 # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-variable # This function works only if OneDrive was already uninstalled, or user is intended to uninstall "OneDrive -Uninstall" within commandline $PresetName = (Get-Variable -Name MyInvocation -Scope Script).Value.PSCommandPath $PSCallStack = (Get-PSCallStack).Position.Text $OneDriveInstalled = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore - # Checking whether function was called from Functions.ps1 - if ($PresetName -match "Functions.ps1") + # Checking whether function was called from Import-TabCompletion.ps1 + if ($PresetName -match "Import-TabCompletion.ps1") { # Checking whether command contains "WinPrtScrFolder -Desktop" if ($PSCallStack -match "WinPrtScrFolder -Desktop") diff --git a/src/Sophia_Script_for_Windows_11/Sophia.ps1 b/src/Sophia_Script_for_Windows_11/Sophia.ps1 index cf25005c..1caaf92e 100644 --- a/src/Sophia_Script_for_Windows_11/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11/Sophia.ps1 @@ -34,8 +34,8 @@ Editions: Home/Pro/Enterprise .NOTES - To use the TAB completion for functions and their arguments dot source the Functions.ps1 script first: - . .\Function.ps1 (with a dot at the beginning) + To use Enable tab completion to invoke for functions if you do not know function name dot source the Import-TabCompletion.ps1 script first: + . .\Import-TabCompletion.ps1 (with a dot at the beginning) Read more at https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-run-the-specific-functions .LINK GitHub @@ -90,7 +90,7 @@ $ScriptFiles = @( "$PSScriptRoot\Localizations\uk-UA\Sophia.psd1", "$PSScriptRoot\Localizations\zh-CN\Sophia.psd1", "$PSScriptRoot\Module\Sophia.psm1", - "$PSScriptRoot\Manifest\Sophia.psd1" + "$PSScriptRoot\Manifest\SophiaScript.psd1" ) if (($ScriptFiles | Test-Path) -contains $false) { @@ -104,7 +104,7 @@ if (($ScriptFiles | Test-Path) -contains $false) exit } -Remove-Module -Name Sophia -Force -ErrorAction Ignore +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore try { Import-LocalizedData -BindingVariable Global:Localization -UICulture $PSUICulture -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia -ErrorAction Stop @@ -117,7 +117,7 @@ catch # Checking whether script is the correct PowerShell version try { - Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force -ErrorAction Stop + Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force -ErrorAction Stop } catch [System.InvalidOperationException] { diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Functions.ps1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Import-TabCompletion.ps1 similarity index 95% rename from src/Sophia_Script_for_Windows_11_LTSC_2024/Functions.ps1 rename to src/Sophia_Script_for_Windows_11_LTSC_2024/Import-TabCompletion.ps1 index d48efef5..05d5fc94 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Import-TabCompletion.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - The TAB completion for functions and their arguments + Enable tab completion to invoke for functions if you do not know function name Version: 6.8.4 Date: 05.04.2025 @@ -10,7 +10,7 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Dot source the script first: . .\Import-TabCompletion.ps1 (with a dot at the beginning) Start typing any characters contained in the function's name or its arguments, and press the TAB button .EXAMPLE @@ -51,8 +51,8 @@ Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.8.4 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" -Remove-Module -Name Sophia -Force -ErrorAction Ignore -Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore +Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia -BaseDirectory $PSScriptRoot\Localizations @@ -73,7 +73,7 @@ $Parameters = @{ ) # Get functions list with arguments to complete - $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys + $Commands = (Get-Module -Name SophiaScript).ExportedCommands.Keys foreach ($Command in $Commands) { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Manifest/SophiaScript.psd1 similarity index 100% rename from src/Sophia_Script_for_Windows_11_LTSC_2024/Manifest/Sophia.psd1 rename to src/Sophia_Script_for_Windows_11_LTSC_2024/Manifest/SophiaScript.psd1 diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 index 71ce216c..4ebefe90 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 @@ -546,7 +546,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Checking wdFilter service try { - if (Get-Service -Name wdFilter -ErrorAction Stop) + if (-not (Get-Service -Name wdFilter -ErrorAction Stop)) { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") @@ -688,7 +688,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); UseBasicParsing = $true } $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024 - $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() + $CurrentRelease = (Get-Module -Name SophiaScript).Version.ToString() if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { @@ -4266,7 +4266,7 @@ function Cursors "%SystemRoot%\Cursors\W11 Cursor Light Free\arrow.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\help.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\appstarting.ani", - "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani",, + "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani", "%SystemRoot%\Cursors\W11 Cursor Light Free\crosshair.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\ibeam.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\nwpen.cur", @@ -7128,15 +7128,15 @@ function WinPrtScrFolder return } - # Checking how the script was invoked: via a preset or Functions.ps1 + # Checking how the script was invoked: via a preset or Import-TabCompletion.ps1 # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-variable # This function works only if OneDrive was already uninstalled, or user is intended to uninstall "OneDrive -Uninstall" within commandline $PresetName = (Get-Variable -Name MyInvocation -Scope Script).Value.PSCommandPath $PSCallStack = (Get-PSCallStack).Position.Text $OneDriveInstalled = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore - # Checking whether function was called from Functions.ps1 - if ($PresetName -match "Functions.ps1") + # Checking whether function was called from Import-TabCompletion.ps1 + if ($PresetName -match "Import-TabCompletion.ps1") { # Checking whether command contains "WinPrtScrFolder -Desktop" if ($PSCallStack -match "WinPrtScrFolder -Desktop") diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 index 11340267..f9fff404 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 @@ -35,8 +35,8 @@ Supported Windows 11 Enterprise LTSC 2024 .NOTES - To use the TAB completion for functions and their arguments dot source the Functions.ps1 script first: - . .\Function.ps1 (with a dot at the beginning) + To use Enable tab completion to invoke for functions if you do not know function name dot source the Import-TabCompletion.ps1 script first: + . .\Import-TabCompletion.ps1 (with a dot at the beginning) Read more at https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-run-the-specific-functions .LINK GitHub @@ -91,7 +91,7 @@ $ScriptFiles = @( "$PSScriptRoot\Localizations\uk-UA\Sophia.psd1", "$PSScriptRoot\Localizations\zh-CN\Sophia.psd1", "$PSScriptRoot\Module\Sophia.psm1", - "$PSScriptRoot\Manifest\Sophia.psd1" + "$PSScriptRoot\Manifest\SophiaScript.psd1" ) if (($ScriptFiles | Test-Path) -contains $false) { @@ -105,7 +105,7 @@ if (($ScriptFiles | Test-Path) -contains $false) exit } -Remove-Module -Name Sophia -Force -ErrorAction Ignore +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore try { Import-LocalizedData -BindingVariable Global:Localization -UICulture $PSUICulture -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia -ErrorAction Stop @@ -118,7 +118,7 @@ catch # Checking whether script is the correct PowerShell version try { - Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force -ErrorAction Stop + Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force -ErrorAction Stop } catch [System.InvalidOperationException] { diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Import-TabCompletion.ps1 similarity index 96% rename from src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1 rename to src/Sophia_Script_for_Windows_11_PowerShell_7/Import-TabCompletion.ps1 index 4d78309a..5f14ad76 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Import-TabCompletion.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - The TAB completion for functions and their arguments + Enable tab completion to invoke for functions if you do not know function name Version: 6.8.4 Date: 05.04.2025 @@ -10,7 +10,7 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Dot source the script first: . .\Import-TabCompletion.ps1 (with a dot at the beginning) Start typing any characters contained in the function's name or its arguments, and press the TAB button .EXAMPLE @@ -51,8 +51,8 @@ Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.8.4 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" -Remove-Module -Name Sophia -Force -ErrorAction Ignore -Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore +Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force try { @@ -80,7 +80,7 @@ $Parameters = @{ ) # Get functions list with arguments to complete - $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys + $Commands = (Get-Module -Name SophiaScript).ExportedCommands.Keys foreach ($Command in $Commands) { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/SophiaScript.psd1 similarity index 100% rename from src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1 rename to src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/SophiaScript.psd1 diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 index da5b92f0..6fbafb79 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 @@ -587,7 +587,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Checking wdFilter service try { - if (Get-Service -Name wdFilter -ErrorAction Stop) + if (-not (Get-Service -Name wdFilter -ErrorAction Stop)) { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") @@ -729,7 +729,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); UseBasicParsing = $true } $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 - $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() + $CurrentRelease = (Get-Module -Name SophiaScript).Version.ToString() if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { @@ -4469,7 +4469,7 @@ function Cursors "%SystemRoot%\Cursors\W11 Cursor Light Free\arrow.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\help.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\appstarting.ani", - "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani",, + "%SystemRoot%\Cursors\W11 Cursor Light Free\wait.ani", "%SystemRoot%\Cursors\W11 Cursor Light Free\crosshair.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\ibeam.cur", "%SystemRoot%\Cursors\W11 Cursor Light Free\nwpen.cur", @@ -7634,15 +7634,15 @@ function WinPrtScrFolder return } - # Checking how the script was invoked: via a preset or Functions.ps1 + # Checking how the script was invoked: via a preset or Import-TabCompletion.ps1 # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-variable # This function works only if OneDrive was already uninstalled, or user is intended to uninstall "OneDrive -Uninstall" within commandline $PresetName = (Get-Variable -Name MyInvocation -Scope Script).Value.PSCommandPath $PSCallStack = (Get-PSCallStack).Position.Text $OneDriveInstalled = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore - # Checking whether function was called from Functions.ps1 - if ($PresetName -match "Functions.ps1") + # Checking whether function was called from Import-TabCompletion.ps1 + if ($PresetName -match "Import-TabCompletion.ps1") { # Checking whether command contains "WinPrtScrFolder -Desktop" if ($PSCallStack -match "WinPrtScrFolder -Desktop") diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 index f42a90ef..efabf97c 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 @@ -37,8 +37,8 @@ Editions: Home/Pro/Enterprise .NOTES - To use the TAB completion for functions and their arguments dot source the Functions.ps1 script first: - . .\Function.ps1 (with a dot at the beginning) + To use Enable tab completion to invoke for functions if you do not know function name dot source the Import-TabCompletion.ps1 script first: + . .\Import-TabCompletion.ps1 (with a dot at the beginning) Read more at https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-run-the-specific-functions .LINK GitHub @@ -93,7 +93,7 @@ $ScriptFiles = @( "$PSScriptRoot\Localizations\uk-UA\Sophia.psd1", "$PSScriptRoot\Localizations\zh-CN\Sophia.psd1", "$PSScriptRoot\Module\Sophia.psm1", - "$PSScriptRoot\Manifest\Sophia.psd1" + "$PSScriptRoot\Manifest\SophiaScript.psd1" ) if (($ScriptFiles | Test-Path) -contains $false) { @@ -107,7 +107,7 @@ if (($ScriptFiles | Test-Path) -contains $false) exit } -Remove-Module -Name Sophia -Force -ErrorAction Ignore +Remove-Module -Name SophiaScript -Force -ErrorAction Ignore # PowerShell 7 doesn't load en-us localization automatically if there is no localization folder in user's language which is determined by $PSUICulture # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-localizeddata?view=powershell-7.3 @@ -124,7 +124,7 @@ catch # Checking whether script is the correct PowerShell version try { - Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force -ErrorAction Stop + Import-Module -Name $PSScriptRoot\Manifest\SophiaScript.psd1 -PassThru -Force -ErrorAction Stop } catch [System.InvalidOperationException] {