catx0rr / OpenRGB

OpenRGB scripts for ARGB LED on PC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenRGB


This is to setup Open RGB on my setup (ASUSTUF-PC) which runs on multiple hardware manufacturers. And eliminate manufacturer bloatware This will 'sync' all ARGB headers from the mother board to the mouse, keyboard and other peripherals that runs with ARGB. It will only use the default profile, which is (LED White). You need to select other profiles to change it.

List of peripheral devices and ARGB hardware:

  • ROG Strix Impact II (Wireless Mouse)
  • Logitech G913 TKL LightSpeed (Wireless Keyboard)
  • ASUS TUF GAMING X570-PLUS (Wi-Fi)
  • NVIDIA GEFORCE RTX 4070ti
  • TFORCE Delta 16GBx2 DDR4 RAM (TUF)
  • Cooler Master HALO MF120 x7
  • Cooler Master MF120 HALO ARGB V2 360mm AIO Liquid Cooler

Photo Samples:


Installation

  • Download Latest openRGB release from website
  • Place the OpenRGB to C:\Program Files (x86) Directory (C:\Program Files (x86)\OpenRGB Windows 64-bit)
  • Download the list of profiles to %appdata%\OpenRGB
  • Run OpenRGB.exe as administrator once (to view all hardware devices and connect to software)
  • Create a Scheduled task to run the powershell script or paste it on a powershell terminal as administrator
  • (powershell.exe -ep bypass -f .\openRGB_automation.ps1)
# create_openRGBtask.ps1
# Change Host and user to your own specifics
$HOSTNAME = "ASUSTUF-PC"
$USERNAME = "catx0rr"
$OPENRGB_DIR_PATH = "C:\Program Files (x86)\OpenRGB Windows 64-bit"
$DEFAULT_PROFILE = "Default"
$LED_OFF_PROFILE = "Darkness"

#### Do not change anything from here ####

## Creating A Login Session Task that will turn on Default profile

$GetScheduledTaskActionParams = @{
    Execute = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" 
    Argument = "-nologo -noni -w h -nop -c `"& '$OPENRGB_DIR_PATH\OpenRGB.exe' --gui --startminimized --profile $DEFAULT_PROFILE.orp`""
}

$GetScheduledTaskPrincipalParams = @{
    UserId = "$HOSTNAME\$USERNAME"
    RunLevel = "Highest"
}

$GetScheduledTaskSettingsParams = @{
    AllowStartIfOnBatteries = $True
    DontStopIfGoingOnBatteries = $True
    StartWhenAvailable = $True
}

$action = New-ScheduledTaskAction @GetScheduledTaskActionParams
$trigger = New-ScheduledTaskTrigger -AtLogon
$principal = New-ScheduledTaskPrincipal @GetScheduledTaskPrincipalParams
$settings = New-ScheduledTaskSettingsSet @GetScheduledTaskSettingsParams
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings
Register-ScheduledTask OpenRGBLogon -InputObject $task

## Creating A Lock Session Task that will turn off all LEDs

$GetScheduledTaskActionParams = @{
    Execute = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" 
    Argument = "-nologo -noni -w h -nop -c `"(& '$OPENRGB_DIR_PATH\OpenRGB.exe' --gui --startminimized --profile $LED_OFF_PROFILE.orp); if (`$?) { Start-Sleep -Seconds 7; Stop-Process -Name 'OpenRGB' }`""
}

$GetScheduledTaskPrincipalParams = @{
    UserId = "$HOSTNAME\$USERNAME"
    RunLevel = "Highest"
}

$GetScheduledTaskSettingsParams = @{
    AllowStartIfOnBatteries = $True
    DontStopIfGoingOnBatteries = $True
    StartWhenAvailable = $True
}

$StateChangeTrigger = Get-CimClass `
    -Namespace ROOT\Microsoft\Windows\TaskScheduler `
    -ClassName MSFT_TaskSessionStateChangeTrigger

$OnLockTrigger = New-CimInstance `
    -CimClass $stateChangeTrigger `
    -Property @{
        # https://learn.microsoft.com/en-us/windows/win32/taskschd/sessionstatechangetrigger-statechange
        StateChange = 7  # TASK_SESSION_STATE_CHANGE_TYPE.TASK_SESSION_LOCK (taskschd.h)
    } `
    -ClientOnly

$action = New-ScheduledTaskAction @GetScheduledTaskActionParams
$trigger = $OnLockTrigger
$principal = New-ScheduledTaskPrincipal @GetScheduledTaskPrincipalParams
$settings = New-ScheduledTaskSettingsSet @GetScheduledTaskSettingsParams
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings
Register-ScheduledTask OpenRGBLockState -InputObject $task

## Creating A Logout Session Task that will turn off all LEDs

$GetScheduledTaskActionParams = @{
    Execute = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" 
    Argument = "-nologo -noni -w h -nop -c `"(& '$OPENRGB_DIR_PATH\OpenRGB.exe' --gui --startminimized --profile $LED_OFF_PROFILE.orp); if (`$?) { Start-Sleep -Seconds 7; Stop-Process -Name 'OpenRGB' }`""
}

$GetScheduledTaskPrincipalParams = @{
    UserId = "$HOSTNAME\$USERNAME"
    RunLevel = "Highest"
}

$GetScheduledTaskSettingsParams = @{
    AllowStartIfOnBatteries = $True
    DontStopIfGoingOnBatteries = $True
    StartWhenAvailable = $True
}

$StateChangeTrigger = Get-CimClass `
    -Namespace ROOT\Microsoft\Windows\TaskScheduler `
    -ClassName MSFT_TaskSessionStateChangeTrigger

$OnLogOutTrigger = New-CimInstance `
    -CimClass $stateChangeTrigger `
    -Property @{
        # https://learn.microsoft.com/en-us/windows/win32/taskschd/sessionstatechangetrigger-statechange
        StateChange = 2  # TASK_SESSION_STATE_CHANGE_TYPE.TASK_SESSION_DISCONNECT (taskschd.h)
    } `
    -ClientOnly

$action = New-ScheduledTaskAction @GetScheduledTaskActionParams
$trigger = $OnLogOutTrigger
$principal = New-ScheduledTaskPrincipal @GetScheduledTaskPrincipalParams
$settings = New-ScheduledTaskSettingsSet @GetScheduledTaskSettingsParams
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings
Register-ScheduledTask OpenRGBLogoutState -InputObject $task

## Creating A Unlock Session Task that will turn on all LEDs to low white

$GetScheduledTaskActionParams = @{
    Execute = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" 
    Argument = "-nologo -noni -w h -nop -c `"& '$OPENRGB_DIR_PATH\OpenRGB.exe' --gui --startminimized --profile $DEFAULT_PROFILE.orp`""
}

$GetScheduledTaskPrincipalParams = @{
    UserId = "$HOSTNAME\$USERNAME"
    RunLevel = "Highest"
}

$GetScheduledTaskSettingsParams = @{
    AllowStartIfOnBatteries = $True
    DontStopIfGoingOnBatteries = $True
    StartWhenAvailable = $True
}

$StateChangeTrigger = Get-CimClass `
    -Namespace ROOT\Microsoft\Windows\TaskScheduler `
    -ClassName MSFT_TaskSessionStateChangeTrigger

$OnUnLockTrigger = New-CimInstance `
    -CimClass $stateChangeTrigger `
    -Property @{
        # https://learn.microsoft.com/en-us/windows/win32/taskschd/sessionstatechangetrigger-statechange
        StateChange = 8  # TASK_SESSION_STATE_CHANGE_TYPE.TASK_SESSION_UNLOCK (taskschd.h)
    } `
    -ClientOnly

$action = New-ScheduledTaskAction @GetScheduledTaskActionParams
$trigger = $OnUnLockTrigger
$principal = New-ScheduledTaskPrincipal @GetScheduledTaskPrincipalParams
$settings = New-ScheduledTaskSettingsSet @GetScheduledTaskSettingsParams
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings
Register-ScheduledTask OpenRGBUnlockState -InputObject $task

Manual Installation

Run task scheduler as administrator

taskschd.msc

task scheduler

OpenRGB (GUI)

  General:
    - User: <user>
    - Run only when user is logged on
    - Run with highest privileges
  Triggers:
    - Begin the task: At log on
    - Specific user: <PC>\<user>
    - Enabled
  Actions:
    - Start a program
    - Program/script: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
    - Add arguments: -nologo -noni -w h -nop -c "& 'C:\OPENRGB\DIR\PATH\OpenRGB.exe' --gui --startminimized --profile <DEFAULT_PROFILE>.orp"
  Conditions:
    - Untick Start the task only if the computer is on AC Power
  Settings:
    - Allow task to be run on demand
    - Run task as soon as possible after a scheduled start is missed
    - Stop the task if it runs longer than: 3 days
    - If the running task does not end when requested, force it to stop
    - Do not start a new instance

OpenRGB Lock State

  General:
    - User: <user>
    - Run only when user is logged on
    - Run with highest privileges
  Triggers:
    - Begin the task: On workstation lock
    - Specific user: <PC>\<user>
    - Enabled
  Actions:
    - Start a program
    - Program/script: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
    - Add arguments: -nologo -noni -w h -nop -c "(& 'C:\OPENRGB\DIR\PATH\OpenRGB.exe' --gui --startminimized --profile <LED_OFF_PROFILE>.orp); if (`$?) { Start-Sleep -Seconds 7; Stop-Process -Name 'OpenRGB' }"
  Settings:
    - Allow task to be run on demand
    - Run task as soon as possible after a scheduled start is missed
    - Stop the task if it runs longer than: 3 days
    - If the running task does not end when requested, force it to stop
    - Do not start a new instance

OpenRGB Logout State

  General:
    - User: <user>
    - Run only when user is logged on
    - Run with highest privileges
  Triggers:
    - Begin the task: On disconnect on user session
    - Specific user: <PC>\<user>
    - Enabled
  Actions:
    - Start a program
    - Program/script: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
    - Add arguments: -nologo -noni -w h -nop -c "(& 'C:\OPENRGB\DIR\PATH\OpenRGB.exe' --gui --startminimized --profile <LED_OFF_PROFILE>.orp); if (`$?) { Start-Sleep -Seconds 7; Stop-Process -Name 'OpenRGB' }"
  Settings:
    - Allow task to be run on demand
    - Run task as soon as possible after a scheduled start is missed
    - Stop the task if it runs longer than: 3 days
    - If the running task does not end when requested, force it to stop
    - Do not start a new instance

OpenRGB Unlock State

  General:
    - User: <user>
    - Run only when user is logged on
    - Run with highest privileges
  Triggers:
    - Begin the task: On workstation unlock
    - Specific user: <PC>\<user>
    - Enabled
  Actions:
    - Start a program
    - Program/script: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
    - Add arguments: -nologo -noni -w h -nop -c "& 'C:\OPENRGB\DIR\PATH\OpenRGB.exe' --gui --startminimized --profile <DEFAULT_PROFILE>.orp"
  Settings:
    - Allow task to be run on demand
    - Run task as soon as possible after a scheduled start is missed
    - Stop the task if it runs longer than: 3 days
    - If the running task does not end when requested, force it to stop
    - Do not start a new instance

References:

https://openrgb-wiki.readthedocs.io/en/latest/OpenRGB-Windows-Setup-and-Usage/ https://stackoverflow.com/questions/11385164/eventviewer-eventid-for-lock-and-unlock https://www.ctrl.blog/entry/idle-task-scheduler-powershell.html https://community.spiceworks.com/t/run-powershell-script-on-windows-event/1010718 https://stackoverflow.com/questions/53704188/syntax-for-execute-on-workstation-unlock https://superuser.com/questions/1673891/how-to-disable-task-scheduler-conditions https://learn.microsoft.com/en-us/windows/win32/taskschd/sessionstatechangetrigger-statechange

About

OpenRGB scripts for ARGB LED on PC


Languages

Language:PowerShell 100.0%