`refactor`: Purge set-script-policy lib

- Only set execution policy when creating the Winget scheduled job
- There's no reason to block script usage, at least from my side
- Update FUNDING.yml because i got GitHub Sponsors working 🥳
main
Plínio Larrubia 2 years ago committed by Plínio Larrubia
parent a1d79cf823
commit e50d3beab8
No known key found for this signature in database
GPG Key ID: 057B0A87CB137C69

@ -1,6 +1,6 @@
# These are supported funding model platforms
#github: [LeDragoX] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: [LeDragoX] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
#patreon: # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
@ -11,9 +11,4 @@
#otechie: # Replace with a single Otechie username
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: [
'[Brazil-Pix]',
'https://nubank.com.br/pagar/19l0tk/5tmn1iB2uZ',
'[International-Paypal]',
'https://www.paypal.com/donate/?hosted_button_id=NETV9RNH6LGR6'
]
# custom: []

@ -161,7 +161,6 @@ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force; ls -Recurse *.ps*1 |
- Help improve the Security of Windows while maintaining performance; ([`optimize-security.ps1`](./src/scripts/optimize-security.ps1))
- Remove OneDrive completely from the System, re-install is possible via Win Store; ([`remove-onedrive.ps1`](./src/scripts/remove-onedrive.ps1))
- Disable/Enable Windows Features specially for Gaming/Productivity; ([`optimize-windows-features.ps1`](./src/scripts/optimize-windows-features.ps1))
- In the End it only locks Local Machine script execution. ([`set-script-policy.psm1`](./src/lib/set-script-policy.psm1))
</details>

@ -33,7 +33,6 @@ function Main() {
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"open-file.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"set-console-style.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"set-script-policy.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"show-dialog-window.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"start-logging.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"title-templates.psm1" -Force
@ -43,11 +42,9 @@ function Main() {
Write-Caption "$((Split-Path -Path $PSCommandPath -Leaf).Split('.')[0]) v$((Get-Item "$(Split-Path -Path $PSCommandPath -Leaf)").LastWriteTimeUtc | Get-Date -Format "yyyy-MM-dd")"
Write-Host "Your Current Folder $pwd"
Write-Host "Script Root Folder $PSScriptRoot"
Unlock-ScriptUsage
Use-WindowsForm
Open-Script # Run all scripts inside 'scripts' folder
Stop-Logging
Block-ScriptUsage
Write-ScriptLogo # Thanks Figlet
Request-PcRestart # Prompt options to Restart the PC
}

@ -1234,7 +1234,6 @@ function Main() {
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"open-file.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"manage-software.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"set-console-style.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"set-script-policy.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"show-dialog-window.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"start-logging.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"title-templates.psm1" -Force
@ -1244,7 +1243,6 @@ function Main() {
Write-Caption "$((Split-Path -Path $PSCommandPath -Leaf).Split('.')[0]) v$((Get-Item "$(Split-Path -Path $PSCommandPath -Leaf)").LastWriteTimeUtc | Get-Date -Format "yyyy-MM-dd")"
Write-Host "Your Current Folder $pwd"
Write-Host "Script Root Folder $PSScriptRoot"
Unlock-ScriptUsage
Open-PowerShellFilesCollection -RelativeLocation "src\scripts" -Scripts "install-package-managers.ps1" -NoDialog # Install Winget and Chocolatey at the beginning
Write-ScriptLogo # Thanks Figlet
Show-GUI # Load the GUI
@ -1254,7 +1252,6 @@ function Main() {
Request-PcRestart # Prompt options to Restart the PC
}
Stop-Logging
Block-ScriptUsage
}
Main

@ -1,21 +0,0 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Unlock-ScriptUsage() {
[CmdletBinding()] param ()
Write-Status -Symbol "@" -Status "Receiving permissions to run scripts as Current User..."
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
}
function Block-ScriptUsage() {
[CmdletBinding()] param ()
Write-Status -Symbol "@" -Status "Denying permissions to run scripts as LocalMachine..."
Set-ExecutionPolicy Restricted -Scope LocalMachine -Force
}
<#
Example:
Unlock-ScriptUsage # to Unlock script usage
Block-ScriptUsage # to Lock script usage
#>

@ -91,6 +91,7 @@ function Main() {
{
Remove-Item -Path "$env:TEMP\Win10-SDT-Logs\*" -Include "WingetDailyUpgrade_*.log"
Start-Transcript -Path "$env:TEMP\Win10-SDT-Logs\WingetDailyUpgrade_$(Get-Date -Format "yyyy-MM-dd_HH-mm-ss").log"
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force # Only needed to run Winget
winget upgrade --all --silent | Out-Host
Stop-Transcript
}

Loading…
Cancel
Save