Forum Discussion
Power BI in digital signage
Thought I would come back with the solution we have started to run at my company. Is working really well on about five different computers now. Never needs a restart. Refreshes BI dashboard pages every 5 minutes.
It is a Powershell script that opens a browser window and just cycles through the dashboards.
1. place the .ps1 file on the Desktop
2. place the .cmd file in the startup folder (in Win 10 = win + r and type shell:startup to open startup folder)
Ths script will open an ie window cycling through PowerBI dashboards every 10 mins
biscreencycle2.ps1 =
[CmdletBinding()]
$source = @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace KeyboardSend
{
public class KeyboardSend
{
[DllImport("user32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
private const int KEYEVENTF_EXTENDEDKEY = 1;
private const int KEYEVENTF_KEYUP = 2;
public static void KeyDown(Keys vKey)
{
keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY, 0);
}
public static void KeyUp(Keys vKey)
{
keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
}
}
}
"@
Add-Type -TypeDefinition $source -ReferencedAssemblies "System.Windows.Forms"
#----------------------------------------------------------[Functions]----------------------------------------------------------
Function FullScreen ()
{
[KeyboardSend.KeyboardSend]::KeyDown("LWin")
[KeyboardSend.KeyboardSend]::KeyDown("LShiftKey")
[KeyboardSend.KeyboardSend]::KeyDown("Return")
[KeyboardSend.KeyboardSend]::KeyUp("LWin")
[KeyboardSend.KeyboardSend]::KeyUp("LShiftKey")
[KeyboardSend.KeyboardSend]::KeyUp("Return")
}
Function CloseTab ()
{
[KeyboardSend.KeyboardSend]::KeyDown("LControlKey")
[KeyboardSend.KeyboardSend]::KeyDown("F4")
[KeyboardSend.KeyboardSend]::KeyUp("LControlKey")
[KeyboardSend.KeyboardSend]::KeyUp("F4")
}
#---------------------------------------------------------[Execution]--------------------------------------------------------
$errorActionPreference = "stop"
#Dashboards for user
$urls = @(
"BI dashboard link1",
"BI dashboard link2",
"BI dashboard link3",
"BI dashboard link4")
# time to display each screen
$sleepSec = 600
$urlIndex = 0
# Start the app
start microsoft-edge:$urls[0]
# Wait and send key stroke
sleep 2
FullScreen
while($true)
{
CloseTab
$url = $urls[$urlIndex]
start microsoft-edge:$url
start-sleep -s $sleepSec
$urlIndex = ($urlIndex + 1) % $urls.length
}BiScreenCycle.cmd
PowerShell -Command "Set-ExecutionPolicy Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1 PowerShell -WindowStyle Hidden C:\Users\%USERNAME%\Desktop\BiScreenCycle2.ps1 >> "%TEMP%\StartupLog.txt" 2>&1
I think one of the conditions is that the browser (edge) needs to have the credentials of the user saved.
Make sure to replace the BI Dashboard links with what you want to look at.
elliotdixon That's pretty nice. I may use that for a case where we need to rotate through between some vendor-specific screens.
DisplayMonkey has been a great signage solution for us. We use it to manage about 20 screens in multiple office locations with a variety of reports, and it has run very smoothly for over a year.