Hi,
Here is the PowerShell code I wrote to change the timer intervals. I'm interested to find out if there are better methods for doing this.
# Set the new timer in ms. Default is 30000 ms (30 Seconds).
$NewTimerInterval = "10000"
$Timers = @("Name = Default","Name = GPU usage")
$ConfigFile = "${env:ProgramFiles}\vast limits\uberAgent\uberAgent.conf"
$FileContent = Get-Content "$ConfigFile"
$ChangeMade = $False
ForEach ($Timer in $Timers) {
$LineNumber = 0
$LineNumber = $FileContent | Select-String -Pattern $Timer | Select-Object -ExpandProperty LineNumber
If ($LineNumber -gt 0) {
$FileContent[$LineNumber -1 + 2] = ($FileContent[$LineNumber -1 + 2] -replace '\d+',"$NewTimerInterval")
write-verbose "Changed the `"$Timer`" timer to an interval of $NewTimerInterval ms" -verbose
$ChangeMade = $True
}
}
If ($ChangeMade) {
Set-Content "$ConfigFile" $FileContent
Write-Verbose "Restarting the uberAgent service..." -Verbose
stop-service "uberAgentSvc" -force
start-service "uberAgentSvc"
}
Cheers,
Jeremy