I am a little late to the game here. I am trying to get this deployed out to our customers PCs/Servers. I am pulling my hair out trying to get it to deploy via our RMM.
If someone wants to take a stab at this, id be glad to pay for some consulting here if we can get it going.
Some details:
All customers PCs are 64 bit.
We use both SuperOps.AI and Level RMM. Same results on both.
I am trying to setup a scheduled task to update the bginfo.bgi every minute. Long term would like for this to be setup to pull the bginfo.bgi every minute from our CDN, that way we can post status updates and estimated call wait times, etc. This can wait, I just need to get it to actually get something up on a desktop right now, niceties like this can come later on.
Here is the script as it sits right now. Nothing is happening, despite the 1 minute run tasks.
# Define URLs and download locations
$exeUrl = "https://public.petrosky.it/Bginfo64.exe"
$bgiUrl = "https://public.petrosky.it/PTSKBginfo/BGconfig.bgi"
$exeOutput = "C:\PetroskyIT\Bginfo64.exe"
$bgiOutput = "C:\PetroskyIT\BGconfig.bgi"
# Create the PetroskyIT directory if it doesn't exist
If (-Not (Test-Path -Path "C:\PetroskyIT")) {
Write-Host "Creating directory C:\PetroskyIT"
New-Item -ItemType Directory -Path "C:\PetroskyIT"
Write-Host "Directory created"
}
# Download Bginfo64.exe
Write-Host "Downloading Bginfo64.exe"
Invoke-WebRequest -Uri $exeUrl -OutFile $exeOutput
Write-Host "Download of Bginfo64.exe completed"
# Download BGconfig.bgi
Write-Host "Downloading BGconfig.bgi"
Invoke-WebRequest -Uri $bgiUrl -OutFile $bgiOutput
Write-Host "Download of BGconfig.bgi completed"
# Create a Scheduled Task to run Bginfo64.exe every minute
$taskName = "RunBginfoEveryMinute"
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "-Command & { Start-Process -FilePath `"$exeOutput`" -ArgumentList `"`"$bgiOutput`" /TIMER:00 /SILENT /NOLICPROMPT`" -Verb RunAs }"
$repetitionDuration = New-TimeSpan -Days 3650
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 1) -RepetitionDuration $repetitionDuration
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
# Check if the task already exists
If (-Not (Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue)) {
Write-Host "Creating scheduled task to run Bginfo64.exe every minute"
Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Principal $principal
Write-Host "Scheduled task created"
} Else {
Write-Host "Task already exists. Skipping creation."
}