Skip to content

Commit

Permalink
🔥 Restructure folders and update scripts.
Browse files Browse the repository at this point in the history
Add a Setup Flow Launcher script.
  • Loading branch information
pratyakshm committed Jan 3, 2024
1 parent 5ca3100 commit 802ef77
Show file tree
Hide file tree
Showing 15 changed files with 265 additions and 403 deletions.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img alt="Files Logo" <img src="files/banner.png" width="450">
<img alt="Files Logo" <img src=".github/banner.png" width="450">
<h2 align="center">WinRice - Set up your Windows device using automation
</h2>
</p>
Expand Down
17 changes: 0 additions & 17 deletions doc/Individual-scripts.md

This file was deleted.

100 changes: 0 additions & 100 deletions files/InstallWinGet.ps1

This file was deleted.

85 changes: 0 additions & 85 deletions files/UnpinStartTiles.ps1

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/DisableVBS.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is a part of the WinRice software
# Copyright (c) 2020-2024 Pratyaksh Mehrotra <[email protected]>
# All rights reserved.

Write-Host "Disabling Virtualization-based security..."
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "HyperVVirtualizationBasedSecurityOptOut" -Type DWord -Value 1 | Out-Null # Undocumented reg to opt out from Hyper-V based VBS
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "EnableVirtualizationBasedSecurity" -Type DWord -Value 0 | Out-Null # Disables VBS
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" -Name "Enabled" -Type DWord -Value 0 | Out-Null # Core isolation switch
Write-Host "Disabled Virtualization-based security."
15 changes: 8 additions & 7 deletions files/EnableVBS.ps1 → scripts/EnableVBS.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This file is a part of the WinRice software
# Copyright (c) 2020-2024 Pratyaksh Mehrotra <[email protected]>
# All rights reserved.

Write-Host "Enabling Virtualization-based security..."
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" -Name "Enabled" -Type DWord -Value 1
bcdedit.exe /set hypervisorlaunchtype auto | Out-Null
# This file is a part of the WinRice software
# Copyright (c) 2020-2024 Pratyaksh Mehrotra <[email protected]>
# All rights reserved.

Write-Host "Enabling Virtualization-based security..."
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "HyperVVirtualizationBasedSecurityOptOut"
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "EnableVirtualizationBasedSecurity"
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" -Name "Enabled" -Type DWord -Value 1
Write-Host "Enabled Virtualization-based security."
50 changes: 21 additions & 29 deletions files/EnableWSL.ps1 → scripts/EnableWSL.ps1
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
# This file is a part of the WinRice software
# Copyright (c) 2020-2024 Pratyaksh Mehrotra <[email protected]>
# All rights reserved.

Function space {
Write-Host " "
}

Function print($text) {
Write-Host $text
}

if ($CurrentBuild -lt 22000) {
print "Enabling Windows Subsystem for Linux..."
Enable-WindowsOptionalFeature -FeatureName "Microsoft-Windows-Subsystem-Linux" -Online -All -NoRestart -WarningAction Ignore | Out-Null
Enable-WindowsOptionalFeature -FeatureName "VirtualMachinePlatform" -Online -All -NoRestart -WarningAction Ignore | Out-Null
if (Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -like "Enterprise*" -or $_.Edition -eq "Education" -or $_.Edition -eq "Professional"}) {
Enable-WindowsOptionalFeature -FeatureName "Microsoft-Hyper-V" -Online -All -NoRestart -WarningAction Ignore | Out-Null
}
else {
$ProductName = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName
print "Could not enable Hyper-V since $ProductName does not support it."
}
print "Enabled Windows Subsystem for Linux."
}
elseif ($CurrentBuild -ge 22000) {
print "Enabling Windows Subsystem for Linux version 2 along with GUI App support..."
wsl --install | Out-Null
print "Enabled Windows Subsystem for Linux."
# This file is a part of the WinRice software
# Copyright (c) 2020-2024 Pratyaksh Mehrotra <[email protected]>
# All rights reserved.

if ($CurrentBuild -lt 22000) {
Write-Host "Enabling Windows Subsystem for Linux..."
Enable-WindowsOptionalFeature -FeatureName "Microsoft-Windows-Subsystem-Linux" -Online -All -NoRestart -WarningAction Ignore | Out-Null
Enable-WindowsOptionalFeature -FeatureName "VirtualMachinePlatform" -Online -All -NoRestart -WarningAction Ignore | Out-Null
if (Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -like "Enterprise*" -or $_.Edition -eq "Education" -or $_.Edition -eq "Professional"}) {
Enable-WindowsOptionalFeature -FeatureName "Microsoft-Hyper-V" -Online -All -NoRestart -WarningAction Ignore | Out-Null
}
else {
$ProductName = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName
Write-Host "Could not enable Hyper-V since $ProductName does not support it."
}
Write-Host "Enabled Windows Subsystem for Linux."
}
elseif ($CurrentBuild -ge 22000) {
Write-Host "Enabling Windows Subsystem for Linux version 2 along with GUI App support..."
wsl --install | Out-Null
Write-Host "Enabled Windows Subsystem for Linux."
}
80 changes: 80 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#Scripts

Scripts for popular functions so that you can run them without having to go through the entire WinRice experience.

To run any script, copy and paste the command into Windows Terminal (Admin).

## Winstall

Installs apps you pre-list in a text file. [Learn more](https://github.com/pratyakshm/WinRice/blob/main/doc/winget/winstall.md).


```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/Winstall.ps1'))
```


## Winget Import

Imports apps from a pre-populated JSON file generated using `winget export` in your older device or previous installation of Windows. [Learn more](https://github.com/pratyakshm/WinRice/blob/main/doc/winget/import.md).

```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/WingetImport.ps1'))
```


## Flow Launcher

Installs [Flow Launcher](https://flowlauncher.com), configures core plugins and installs onsetGlaze acrylic theme.

Check failure on line 28 in scripts/README.md

View workflow job for this annotation

GitHub Actions / Spell checking

`flowlauncher` is not a recognized word. (unrecognized-spelling)

```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/SetupFlowLauncher.ps1'))
```


## Windows Subsystem for Linux

### Enable

```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/EnableWSL.ps1'))
```


## Virtualization-based security

### Enable

```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/EnableVBS.ps1'))
```

### Disable

```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/DisableVBS.ps1'))
```


## Windows Update

### Setup Policies ([see policies](https://github.com/pratyakshm/WinRice/blob/main/doc/Main-brief.md#%EF%B8%8F-windows-update))

```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/SetupWU.ps1'))
```

### Restore Default Policies

```powershell
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pratyakshm/WinRice/main/scripts/ResetWU.ps1'))
```


---


## Feedback

If you have observed an issue with docs or if there are accessibility issues, please consider [filing an issue](https://github.com/pratyakshm/WinRice/issues/new?assignees=pratyakshm&labels=Issue-Docs&template=doc_issue.yaml&title=Docs+issue%3A+).
10 changes: 5 additions & 5 deletions files/ResetWindowsUpdate.ps1 → scripts/ResetWU.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is a part of the WinRice software
# Copyright (c) 2020-2024 Pratyaksh Mehrotra <[email protected]>
# All rights reserved.

Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Recurse
# This file is a part of the WinRice software
# Copyright (c) 2020-2024 Pratyaksh Mehrotra <[email protected]>
# All rights reserved.

Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Recurse
Write-Host "Windows Update settings have been reset."
Loading

1 comment on commit 802ef77

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (4)

afbb
ccd
flowlauncher
NBLGGH

Previously acknowledged words that are now absent bcdedit ecd hypervisorlaunchtype ization Minecraft nblggh nns OZr protonmail pwd ssign winrice WSA 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:pratyakshm/WinRice.git repository
on the main branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/pratyakshm/WinRice/actions/runs/7395436898/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (273) from .github/actions/spelling/expect.txt and unrecognized words (4)

Dictionary Entries Covers Uniquely
cspell:software-terms/dict/softwareTerms.txt 1288 30 3
cspell:powershell/dict/powershell.txt 91 13 3
cspell:dotnet/dict/dotnet.txt 405 21 2
cspell:python/src/python/python-lib.txt 2417 19 1
cspell:php/dict/php.txt 1689 19

Consider adding them (in .github/workflows/spelling.yml) for uses: check-spelling/check-spelling@main in its with:

      with:
        extra_dictionaries:
          cspell:software-terms/dict/softwareTerms.txt
          cspell:powershell/dict/powershell.txt
          cspell:dotnet/dict/dotnet.txt
          cspell:python/src/python/python-lib.txt
          cspell:php/dict/php.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling.yml) for uses: check-spelling/check-spelling@main in its with:

check_extra_dictionaries: ''
Errors (1)

See the 📜action log or 📝 job summary for details.

❌ Errors Count
❌ ignored-expect-variant 2

See ❌ Event descriptions for more information.

If the flagged items are false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Please sign in to comment.