Windows device management is in beta.
Send scripts to Windows devices through a blueprint or from the Devices & Groups page. The following scripts are presented here as a reference only. Run these scripts at your own risk.
Toggle Bluetooth Off
# Disable Bluetooth Radio(s)
$btDevices = Get-PnpDevice -Class Bluetooth -ErrorAction SilentlyContinue
foreach ($dev in $btDevices) {
Disable-PnpDevice -InstanceId $dev.InstanceId -Confirm:$false -ErrorAction SilentlyContinue
}
# Disable Bluetooth Support Service
Stop-Service -Name "bthserv" -Force
Set-Service -Name "bthserv" -StartupType DisabledToggle Bluetooth On
# Enable Bluetooth Support Service (set to Automatic and start it)
Set-Service -Name "bthserv" -StartupType Automatic -ErrorAction SilentlyContinue
Start-Service -Name "bthserv" -ErrorAction SilentlyContinue
# Enable Bluetooth Radio(s) / devices
$btDevices = Get-PnpDevice -Class Bluetooth -ErrorAction SilentlyContinue
foreach ($dev in $btDevices) {
Enable-PnpDevice -InstanceId $dev.InstanceId -Confirm:$false -ErrorAction SilentlyContinue
}Change Screen Brightness to 10%
(Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1,10)Change Screen Brightness to 80%
(Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1,80)Add EXE Firefox app
Launch the Firefox app. You may need to modify this script based on your system.
$ErrorActionPreference = 'Stop'
$ffUrl = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US"
$out = Join-Path $env:TEMP "FirefoxSetup.exe"
Write-Output "[INFO] Running as: $(whoami)"
Write-Output "[INFO] Downloading Firefox full installer..."
Invoke-WebRequest -Uri $ffUrl -OutFile $out
Write-Output "[INFO] Verifying signature..."
$sig = Get-AuthenticodeSignature -FilePath $out
if ($sig.Status -ne 'Valid') { throw "[ERROR] Invalid signature: $($sig.Status)" }
if ($sig.SignerCertificate.Subject -notmatch 'Mozilla') { throw "[ERROR] Signer not Mozilla: $($sig.SignerCertificate.Subject)" }
Write-Output "[INFO] Installing silently (machine-wide)..."
$proc = Start-Process -FilePath $out -ArgumentList "/S" -Wait -PassThru -NoNewWindow
Write-Output "[INFO] Installer exit code: $($proc.ExitCode)"
if ($proc.ExitCode -ne 0) { throw "[ERROR] Install failed with exit code $($proc.ExitCode)" }
# Verify
$exe1 = "$env:ProgramFiles\Mozilla Firefox\firefox.exe"
$exe2 = "$env:ProgramFiles(x86)\Mozilla Firefox\firefox.exe"
if (Test-Path $exe1) { Write-Output "[INFO] Installed: $exe1"; exit 0 }
if (Test-Path $exe2) { Write-Output "[INFO] Installed: $exe2"; exit 0 }
throw "[ERROR] Installer reported success but firefox.exe not found in Program Files."