Skip to content

Commit

Permalink
🔥 Restructure folders and update scripts.
Browse files Browse the repository at this point in the history
Added a Setup Flow Launcher script
  • Loading branch information
pratyakshm committed Jan 3, 2024
1 parent 5ca3100 commit ccea48c
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

I've created seperate scripts for popular functions so that you can run them without having to go through the entire WinRice experience.

Check failure on line 3 in scripts/README.md

View workflow job for this annotation

GitHub Actions / Spell checking

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

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

## Deployment

### 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'))
```



## OS

### 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

0 comments on commit ccea48c

Please sign in to comment.