PowerShell script that configures the Local Group Policy of a Windows machine so that Omnissa DEM (Dynamic Environment Manager) executes its Computer Environment Startup and Shutdown Tasks.
It automates exactly the manual procedure described in the official Omnissa documentation, Windows Configuration for Computer Environment Startup and Shutdown Tasks — no deviations, no extra settings.
Doing this by hand means clicking through gpedit.msc on every machine (or every golden
image). This script writes the same settings directly to Registry.pol, the Group Policy
registry hive and scripts.ini, so it can be run unattended — for example during image
creation or via a deployment tool.
These are the steps from the Omnissa guide linked above, applied automatically:
- Disables
Computer Configuration > Administrative Templates > System > Scripts > Run startup scripts asynchronously— startup scripts then run synchronously, which DEM requires so that its startup tasks finish before the user logon continues. - Registers
FlexEngine.exeas a local startup script with the parameter-StartupTasksand as a shutdown script with-ShutdownTasks(Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)). - Creates
%SystemRoot%\System32\GroupPolicy\Machine\Scripts\scripts.iniso the entries are also visible in thegpedit.mscGUI. - Removes stale
RunComputerPSScriptsFirst/RunPSScriptsFirstvalues fromRegistry.poland runsgpupdate /force.
- Windows with the Local Group Policy Editor (Pro / Enterprise / Server)
- An elevated PowerShell session (
#Requires -RunAsAdministrator) - Omnissa DEM FlexEngine installed at
C:\Program Files\Omnissa\DEM\FlexEngine.exe - The
PolicyFileEditormodule — installed automatically from the PowerShell Gallery if missing
Run this in an elevated PowerShell session. It always pulls the newest published release:
irm https://github.com/tomcek42/Omnissa-DEM-Configure-Startup-Shutdown-Tasks/releases/latest/download/DEM_Configure_Startup_Shutdown_Tasks.ps1 | iex# Run in an elevated PowerShell session
.\DEM_Configure_Startup_Shutdown_Tasks.ps1A reboot is required for the policies to take effect.
If DEM is installed elsewhere, adjust the path near the top of Part 2:
$flexEnginePath = "C:\Program Files\Omnissa\DEM\FlexEngine.exe"Open gpedit.msc and check:
Computer Configuration > Administrative Templates > System > Scripts→ Run startup scripts asynchronously = DisabledComputer Configuration > Windows Settings > Scripts (Startup/Shutdown)→ Startup:FlexEngine.exe -StartupTasks→ Shutdown:FlexEngine.exe -ShutdownTasks
- The script writes to the local policy. In a domain, an equivalent GPO is usually the better choice — this is aimed at golden images, non-domain machines and standalone hosts.
- Existing local startup/shutdown script entries with index
0are overwritten.
MIT