diff --git a/files/banner.png b/.github/banner.png
similarity index 100%
rename from files/banner.png
rename to .github/banner.png
diff --git a/files/logo.ico b/.github/logo.ico
similarity index 100%
rename from files/logo.ico
rename to .github/logo.ico
diff --git a/README.md b/README.md
index 93fcb6b..80fe100 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-
+
WinRice - Set up your Windows device using automation
diff --git a/doc/Individual-scripts.md b/doc/Individual-scripts.md
deleted file mode 100644
index 5fd94dc..0000000
--- a/doc/Individual-scripts.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Individual scripts
-
-| Feature | Code to run (paste in Windows Terminal (Admin) |
-| --------------------------------------- | ---------------------------------------------------------------------------------------------- |
-| Windows Update: Setup policies | `Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurYt'))` |
-| Windows Update: Reset policies | `Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurY4'))` |
-| Windows Subsystem for Linux: Enable WSL | `Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurYa'))` |
-| WinGet: Install WinGet | `Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurY1'))` |
-| WinGet: Use Winstall | `Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/Jur3G'))` |
-| WinGet: Import apps | `Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/Jur3F'))` |
-| Enable Virtualization-based security | `Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/J9OZr'))` |
-
----
-
-## 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+).
diff --git a/files/InstallWinGet.ps1 b/files/InstallWinGet.ps1
deleted file mode 100644
index 6f8b12d..0000000
--- a/files/InstallWinGet.ps1
+++ /dev/null
@@ -1,100 +0,0 @@
-$ErrorActionPreference = 'SilentlyContinue'
-$ProgressPreference = 'SilentlyContinue'
-
-Function space {
- Write-Host " "
-}
-
-Function print($text) {
- Write-Host $text
-}
-
-space
-if (Get-Command winget) {
- print "WinGet is already installed on this device."
- return
-}
-# Create new folder and set location.
-if (!(Test-Path WinRice)) {
- New-Item WinRice -ItemType Directory | Out-Null
- $currentdir = $(Get-Location).Path; $dir = "$currentdir/WinRice"; Set-Location $dir
-}
-else {
- Set-Location WinRice
-}
-
-# Credit: https://dev.to/kaiwalter/download-windows-store-apps-with-powershell-from-https-store-rg-adguard-net-155m.
-Write-Host "Installing HEVC Video Extensions..."
-$apiUrl = "https://store.rg-adguard.net/api/GetFiles"
-$productUrl = "https://www.microsoft.com/en-us/p/9nblggh4nns1"
-$downloadFolder = Join-Path (Get-Location).Path "WinRice"
-if(!(Test-Path $downloadFolder -PathType Container)) {
- New-Item $downloadFolder -ItemType Directory -Force | Out-Null
-}
-$body = @{
- type = 'url'
- url = $productUrl
- ring = 'Retail'
- lang = 'en-US'
-}
-
-$raw = Invoke-RestMethod -Method Post -Uri $apiUrl -ContentType 'application/x-www-form-urlencoded' -Body $body
-
-$raw | Select-String '.*)"\s.*>(?.*)<\/a>' -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object {
- $url = $_.Groups[1].Value
- $text = $_.Groups[2].Value
- if($text -match "_(x64|neutral).*appx(|bundle)$") {
- $downloadFile = Join-Path $downloadFolder $text
- Invoke-WebRequest -Uri $url -OutFile $downloadFile
- }
- }
- Set-Location WinRice
- Add-AppxPackage Microsoft.Desktop*
- Set-Location ../
- Remove-Item WinRice -Recurse -Force
- if (!(Get-Command winget))
- {
- print "Could not install WinGet. Falling back to legacy method."
- print "Warning: Legacy method will install an older version of winget, please update 'App Installer' from Microsoft later on."
- print "Preparing download..."
- # Create new folder and set location.
- if (!(Test-Path WinRice)) {
- New-Item WinRice -ItemType Directory | out-Null
- $currentdir = $(Get-Location).Path
- $dir = "$currentdir/WinRice"
- Set-Location $dir
- }
- else {
- Set-Location WinRice
- }
-
- # Download the packages.
- $WinGetURL = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
- print "Downloading WinGet installation packages..."
- Start-BitsTransfer $WinGetURL.assets.browser_download_url;
-
- if (!(Get-AppxPackage "Microsoft.VCLibs.*.UWPDesktop")) {
- $VCLibs = "Microsoft.VCLibs.140.00.UWPDesktop_14.0.30035.0_x64__8wekyb3d8bbwe.Appx"
- Start-BitsTransfer $VCLibs
- Add-AppxPackage Microsoft.VCLibs.140.00.UWPDesktop_14.0.30035.0_x64__8wekyb3d8bbwe.Appx
- }
-
- # Install WinGet.
- print "Installing WinGet..."
- Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
-
- # Cleanup installers.
- Set-Location ..
- Remove-Item WinRice -Recurse -Force
-
- # Get-Command winget, if it works then print success message.
- if (Get-Command winget) {
- print "Installed WinGet."
- }
- else {
- print "WinGet could not be installed."
- return
- }
- }
-
-print "Installed WinGet."
\ No newline at end of file
diff --git a/files/UnpinStartTiles.ps1 b/files/UnpinStartTiles.ps1
deleted file mode 100644
index 4e4f483..0000000
--- a/files/UnpinStartTiles.ps1
+++ /dev/null
@@ -1,85 +0,0 @@
-# This file is a part of the WinRice software
-# Copyright (c) 2020-2024 Pratyaksh Mehrotra
-# All rights reserved.
-
-Function space {
- Write-Host " "
-}
-
-Function print($text) {
- Write-Host $text
-}
-
-print "Unpinning all tiles from start menu..."
-
-Set-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -Value ''
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ' '
-Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value ''
-
-$START_MENU_LAYOUT = @"
-
-
-
-
-
-
-
-
-"@
-
-$layoutFile="C:\Windows\StartMenuLayout.xml"
-
-# Delete layout file if it already exists
-If(Test-Path $layoutFile)
-{
- Remove-Item $layoutFile
-}
-
-# Creates the blank layout file
-$START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII
-
-$regAliases = @("HKLM", "HKCU")
-
-#A ssign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
-foreach ($regAlias in $regAliases){
- $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
- $keyPath = $basePath + "\Explorer"
- IF(!(Test-Path -Path $keyPath)) {
- New-Item -Path $basePath -Name "Explorer"
- }
- Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
- Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
- }
-
-# Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process
-Stop-Process -name explorer
-Start-Sleep -s 5
-$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
-Start-Sleep -s 5
-
-# Enable the ability to pin items again by disabling "LockedStartLayout"
-foreach ($regAlias in $regAliases){
- $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
- $keyPath = $basePath + "\Explorer"
- Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
- }
-
-# Uncomment the next line to make clean start menu default for all new users
-Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
-
-Remove-Item $layoutFile
-
-print "Unpinned tiles from Start menu."
\ No newline at end of file
diff --git a/scripts/DisableVBS.ps1 b/scripts/DisableVBS.ps1
new file mode 100644
index 0000000..f3b67d7
--- /dev/null
+++ b/scripts/DisableVBS.ps1
@@ -0,0 +1,9 @@
+# This file is a part of the WinRice software
+# Copyright (c) 2020-2024 Pratyaksh Mehrotra
+# 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."
\ No newline at end of file
diff --git a/files/EnableVBS.ps1 b/scripts/EnableVBS.ps1
similarity index 61%
rename from files/EnableVBS.ps1
rename to scripts/EnableVBS.ps1
index e21453a..d4d2fff 100644
--- a/files/EnableVBS.ps1
+++ b/scripts/EnableVBS.ps1
@@ -1,8 +1,9 @@
-# This file is a part of the WinRice software
-# Copyright (c) 2020-2024 Pratyaksh Mehrotra
-# 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
+# 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."
\ No newline at end of file
diff --git a/files/EnableWSL.ps1 b/scripts/EnableWSL.ps1
similarity index 97%
rename from files/EnableWSL.ps1
rename to scripts/EnableWSL.ps1
index 8e74c90..5ae105f 100644
--- a/files/EnableWSL.ps1
+++ b/scripts/EnableWSL.ps1
@@ -1,30 +1,30 @@
-# This file is a part of the WinRice software
-# Copyright (c) 2020-2024 Pratyaksh Mehrotra
-# 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
+# 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."
}
\ No newline at end of file
diff --git a/scripts/README.md b/scripts/README.md
new file mode 100644
index 0000000..4e91cc6
--- /dev/null
+++ b/scripts/README.md
@@ -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.
+
+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.
+
+```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+).
diff --git a/files/ResetWindowsUpdate.ps1 b/scripts/ResetWU.ps1
similarity index 98%
rename from files/ResetWindowsUpdate.ps1
rename to scripts/ResetWU.ps1
index b0a3510..25d0c55 100644
--- a/files/ResetWindowsUpdate.ps1
+++ b/scripts/ResetWU.ps1
@@ -1,6 +1,6 @@
-# This file is a part of the WinRice software
-# Copyright (c) 2020-2024 Pratyaksh Mehrotra
-# 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
+# All rights reserved.
+
+Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Recurse
Write-Host "Windows Update settings have been reset."
\ No newline at end of file
diff --git a/files/SetupFlowLauncher.ps1 b/scripts/SetupFlowLauncher.ps1
similarity index 100%
rename from files/SetupFlowLauncher.ps1
rename to scripts/SetupFlowLauncher.ps1
diff --git a/files/SetupWindowsUpdate.ps1 b/scripts/SetupWU.ps1
similarity index 97%
rename from files/SetupWindowsUpdate.ps1
rename to scripts/SetupWU.ps1
index 35736f9..a5d8488 100644
--- a/files/SetupWindowsUpdate.ps1
+++ b/scripts/SetupWU.ps1
@@ -1,56 +1,56 @@
-# This file is a part of the WinRice software
-# Copyright (c) 2020-2024 Pratyaksh Mehrotra
-# All rights reserved.
-Function space {
- Write-Host " "
-}
-
-Function print($text) {
- Write-Host $text
-}
-
-$CurrentVersionPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
-$CurrentBuild = Get-ItemPropertyValue $CurrentVersionPath -Name CurrentBuild
-$ProductName = Get-ItemPropertyValue $CurrentVersionPath -Name ProductName
-
-if ($CurrentBuild -ge 22000) {
- print "WinRice currently cannot set up Windows Update policies on Windows 11."
- exit
-}
-
-# Get Windows Edition, if its Professional, Education, or Enterprise.
-if (!(Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -like "Enterprise*" -or $_.Edition -eq "Education" -or $_.Edition -eq "Professional"})) {
- print "$ProductName does not support setting up Windows Update policies."
- return
-}
-print "Setting up Windows Update policies..."
-
-# Declare registry keys locations.
-$Update1 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
-$Update2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
-if (!(Test-Path $Update1)) {
- New-Item -Path $Update1 | Out-Null
- New-Item -Path $Update2 | Out-Null
-}
-
-# Write registry values.
-Set-ItemProperty -Path $Update1 -Name DeferQualityUpdates -Type DWord -Value 1
-Set-ItemProperty -Path $Update1 -Name DeferQualityUpdatesPeriodInDays -Type DWord -Value 4
-Set-ItemProperty -Path $Update1 -Name DeferFeatureUpdates -Type DWord -Value 1
-Set-ItemProperty -Path $Update1 -Name DeferFeatureUpdatesPeriodInDays -Type DWord -Value 20
-Set-ItemProperty -Path $Update2 -Name NoAutoUpdate -Type DWord -Value 1
-Set-ItemProperty -Path $Update2 -Name NoAutoRebootWithLoggedOnUsers -Type Dword -Value 1
-
-# print user message; policies applied.
-$WinUpdatePolicies =@(
- "Turned off automatic updates"
- "Device will no longer auto restart if users are signed in"
- "Turned off re-installation of apps after Windows Updates"
- "Delayed quality updates by 4 days"
- "Delayed feature updates by 20 days"
-)
-ForEach ($WinUpdatePolicy in $WinUpdatePolicies) {
- print " - $WinUpdatePolicy"
-}
-
+# This file is a part of the WinRice software
+# Copyright (c) 2020-2024 Pratyaksh Mehrotra
+# All rights reserved.
+Function space {
+ Write-Host " "
+}
+
+Function print($text) {
+ Write-Host $text
+}
+
+$CurrentVersionPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
+$CurrentBuild = Get-ItemPropertyValue $CurrentVersionPath -Name CurrentBuild
+$ProductName = Get-ItemPropertyValue $CurrentVersionPath -Name ProductName
+
+if ($CurrentBuild -ge 22000) {
+ print "WinRice currently cannot set up Windows Update policies on Windows 11."
+ exit
+}
+
+# Get Windows Edition, if its Professional, Education, or Enterprise.
+if (!(Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -like "Enterprise*" -or $_.Edition -eq "Education" -or $_.Edition -eq "Professional"})) {
+ print "$ProductName does not support setting up Windows Update policies."
+ return
+}
+print "Setting up Windows Update policies..."
+
+# Declare registry keys locations.
+$Update1 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
+$Update2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
+if (!(Test-Path $Update1)) {
+ New-Item -Path $Update1 | Out-Null
+ New-Item -Path $Update2 | Out-Null
+}
+
+# Write registry values.
+Set-ItemProperty -Path $Update1 -Name DeferQualityUpdates -Type DWord -Value 1
+Set-ItemProperty -Path $Update1 -Name DeferQualityUpdatesPeriodInDays -Type DWord -Value 4
+Set-ItemProperty -Path $Update1 -Name DeferFeatureUpdates -Type DWord -Value 1
+Set-ItemProperty -Path $Update1 -Name DeferFeatureUpdatesPeriodInDays -Type DWord -Value 20
+Set-ItemProperty -Path $Update2 -Name NoAutoUpdate -Type DWord -Value 1
+Set-ItemProperty -Path $Update2 -Name NoAutoRebootWithLoggedOnUsers -Type Dword -Value 1
+
+# print user message; policies applied.
+$WinUpdatePolicies =@(
+ "Turned off automatic updates"
+ "Device will no longer auto restart if users are signed in"
+ "Turned off re-installation of apps after Windows Updates"
+ "Delayed quality updates by 4 days"
+ "Delayed feature updates by 20 days"
+)
+ForEach ($WinUpdatePolicy in $WinUpdatePolicies) {
+ print " - $WinUpdatePolicy"
+}
+
print "Set up Windows Update policies."
\ No newline at end of file
diff --git a/files/wingetimport.ps1 b/scripts/WingetImport.ps1
similarity index 97%
rename from files/wingetimport.ps1
rename to scripts/WingetImport.ps1
index cfb8886..2f6cda3 100644
--- a/files/wingetimport.ps1
+++ b/scripts/WingetImport.ps1
@@ -1,26 +1,26 @@
-# This file is a part of the WinRice software
-# Copyright (c) 2020-2024 Pratyaksh Mehrotra
-# All rights reserved.
-
-Function print($text) {
- Write-Host $text
-}
-
-if (!(Get-Command winget)) {
- Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurY1'))
-}
-space
-[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
-print "Select the exported JSON from File Picker UI"
-$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
-$OpenFileDialog.InitialDirectory = $initialDirectory
-$OpenFileDialog.Filter = "JSON (*.json)| *.json"
-$OpenFileDialog.ShowDialog() | Out-Null
-if ($OpenFileDialog.FileName) {
- print "Initializing JSON file..."
- Start-Sleep -Milliseconds 200
- winget import $OpenFileDialog.FileName
-}
-elseif (!($OpenFileDialog.FileName)) {
- print "No JSON selected."
+# This file is a part of the WinRice software
+# Copyright (c) 2020-2024 Pratyaksh Mehrotra
+# All rights reserved.
+
+Function print($text) {
+ Write-Host $text
+}
+
+if (!(Get-Command winget)) {
+ Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurY1'))
+}
+space
+[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
+print "Select the exported JSON from File Picker UI"
+$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
+$OpenFileDialog.InitialDirectory = $initialDirectory
+$OpenFileDialog.Filter = "JSON (*.json)| *.json"
+$OpenFileDialog.ShowDialog() | Out-Null
+if ($OpenFileDialog.FileName) {
+ print "Initializing JSON file..."
+ Start-Sleep -Milliseconds 200
+ winget import $OpenFileDialog.FileName
+}
+elseif (!($OpenFileDialog.FileName)) {
+ print "No JSON selected."
}
\ No newline at end of file
diff --git a/files/Winstall.ps1 b/scripts/Winstall.ps1
similarity index 97%
rename from files/Winstall.ps1
rename to scripts/Winstall.ps1
index cee36b2..7e2612d 100644
--- a/files/Winstall.ps1
+++ b/scripts/Winstall.ps1
@@ -1,56 +1,56 @@
-# This file is a part of the WinRice software
-# Copyright (c) 2020-2024 Pratyaksh Mehrotra
-# All rights reserved.
-
-Function print($text) {
- Write-Host $text
-}
-
-
-if (!(Get-Command winget)) {
- Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurY1'))
-}
-
-# Try Winstall.txt
-if (Test-Path Winstall.txt) {
- print "Starting Winstall..."
- # Get each line from the text file and use winget install command on it.
- Get-Content 'Winstall.txt' | ForEach-Object {
- $App = $_.Split('=')
- print " Installing $App..."
- winget install "$App" --silent | Out-Null
- }
- print "Winstall has successfully installed the app(s)."
-}
-
-# Try winstall.txt
-elseif (Test-Path winstall.txt) {
- print "Starting Winstall..."
- # Get each line from the text file and use winget install command on it.
- Get-Content 'winstall.txt' | ForEach-Object {
- $App = $_.Split('=')
- print " Installing $App..."
- winget install "$App" --silent | Out-Null
- }
- print "Winstall has successfully installed the app(s)."
-}
-else {
- [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
- print "Select Winstall text file from File Picker UI"
- $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
- $OpenFileDialog.InitialDirectory = $initialDirectory
- $OpenFileDialog.Filter = "Text file (*.txt)| *.txt"
- $OpenFileDialog.ShowDialog() | Out-Null
- if ($OpenFileDialog.FileName) {
- print "Starting Winstall..."
- Get-Content $OpenFileDialog.FileName | ForEach-Object {
- $App = $_.Split('=')
- print " Installing $App..."
- winget install "$App" --silent | Out-Null
- }
- print "Winstall has successfully installed the app(s)."
- }
- else {
- print "No text file was picked."
- }
+# This file is a part of the WinRice software
+# Copyright (c) 2020-2024 Pratyaksh Mehrotra
+# All rights reserved.
+
+Function print($text) {
+ Write-Host $text
+}
+
+
+if (!(Get-Command winget)) {
+ Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://git.io/JurY1'))
+}
+
+# Try Winstall.txt
+if (Test-Path Winstall.txt) {
+ print "Starting Winstall..."
+ # Get each line from the text file and use winget install command on it.
+ Get-Content 'Winstall.txt' | ForEach-Object {
+ $App = $_.Split('=')
+ print " Installing $App..."
+ winget install "$App" --silent | Out-Null
+ }
+ print "Winstall has successfully installed the app(s)."
+}
+
+# Try winstall.txt
+elseif (Test-Path winstall.txt) {
+ print "Starting Winstall..."
+ # Get each line from the text file and use winget install command on it.
+ Get-Content 'winstall.txt' | ForEach-Object {
+ $App = $_.Split('=')
+ print " Installing $App..."
+ winget install "$App" --silent | Out-Null
+ }
+ print "Winstall has successfully installed the app(s)."
+}
+else {
+ [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
+ print "Select Winstall text file from File Picker UI"
+ $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
+ $OpenFileDialog.InitialDirectory = $initialDirectory
+ $OpenFileDialog.Filter = "Text file (*.txt)| *.txt"
+ $OpenFileDialog.ShowDialog() | Out-Null
+ if ($OpenFileDialog.FileName) {
+ print "Starting Winstall..."
+ Get-Content $OpenFileDialog.FileName | ForEach-Object {
+ $App = $_.Split('=')
+ print " Installing $App..."
+ winget install "$App" --silent | Out-Null
+ }
+ print "Winstall has successfully installed the app(s)."
+ }
+ else {
+ print "No text file was picked."
+ }
}
\ No newline at end of file