Skip to content

Custom preset

Pratyaksh Mehrotra edited this page Oct 31, 2021 · 1 revision

What is a custom preset?

A custom preset is your own defined set of functions that will be called when the script runs. WinRice supports this just as any other PowerShell script.

There are a lot of reasons why customizing presets can be useful. This especially comes in very handy when you want only a set of functions that you define to run, instead of running the entire script. Other reasons of customizing preset might be reverting changes done by WinRice.

Customizing the preset

  1. Copy paste the below command into PowerShell to download the latest code

     curl -O https://raw.githubusercontent.com/pratyakshm/WinRice/main/WinRice.ps1
    
  2. Edit the WinRice.ps1 file using your desired text editor of choice.

  3. Comment the functions you don't want to run.
    For instance, If DisableActivityHistory is commented, it won't be run. If DisableActivityHistory is NOT commented, it will be run.

  4. Once done customizing presets, save the file.

Running the code

Check your ExecutionPolicy using PowerShell (Admin) using the following command:

Get-ExecutionPolicy 

By default, ExecutionPolicy is set to Restricted on all PCs.
Even though unrestricting ExecutionPolicy is compulsory for WinRice to run, doing so has proved to increase malware attack surface.
Thus, it is strongly recommended to bypass the ExecutionPolicy only for the current process. This means, only the active PowerShell window (which will run WinRice) will bypass the ExecutionPolicy, whereas it will still be enforced everywhere else in the system. This is more secure than setting ExecutionPolicy to Unrestricted systemwide.

Use the following command to bypass ExecutionPolicy only for the current process:

Set-ExecutionPolicy Bypass -Scope Process -Force 

In PowerShell, Set-Location or cd to where the customized WinRice.ps1 file is, using the cd command.
Ensuring you're in the same directory, use .\WinRice.ps1 to run the script.

Clone this wiki locally