我需要帮助来编写用于自动风扇控制的Powershell脚本

时间:2019-05-17 20:03:07

标签: powershell

我遇到了一个Powershell脚本,通过msiafterburner控制gpu配置文件。例如,如果播放csgo,它将自动切换配置文件。

$csgo = 0
$portal2 = 0

do{
Start-Sleep -s 10

$iscsgoRunning = Get-Process "csgo" -ErrorAction SilentlyContinue
$isportal2Running = Get-Process "portal2" -ErrorAction SilentlyContinue

    if($iscsgoRunning -and $csgo -eq 0 ){  
            & 'C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe' -profile2
            $csgo = 1
            "Applied Profile 2 (csgo is running, advanced overclock)"
    }
    if(!$iscsgoRunning -and $csgo -eq 1 ){
            & 'C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe' -profile3
            $csgo = 0
            "Applied Profile 3 (csgo is not running, reverting to default)"
    }
    Start-Sleep -s 10
    if($isportal2Running -and $portal2 -eq 0 ){  
            & 'C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe' -profile5
            $portal2 = 1
            "Applied Profile 5 (portal2 is running, no overclock)"
    }
    if(!$isportal2Running -and $portal2 -eq 1 ){
            & 'C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe' -profile3
            $portal2 = 0
            "Applied Profile 3 (portal2 is not running, reverting to default)"
    }
    sleep 1
}
while (1)

我想通过“ argus monitor”应用程序控制机箱风扇。例如,如果运行Csgo,我希望我的幽灵风扇切换配置文件2。是否可能像msiafterburner一样?我对编码不熟悉。

argus monitor

argus monitor

0 个答案:

没有答案