Skip to content

Instantly share code, notes, and snippets.

@stevenharman
Created February 1, 2012 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stevenharman/1718397 to your computer and use it in GitHub Desktop.
Save stevenharman/1718397 to your computer and use it in GitHub Desktop.
Allow a Windows service to interact with the desktop without being LocalSystem
# stolen from:
# http://lostechies.com/keithdahlby/2011/08/13/allowing-a-windows-service-to-interact-with-desktop-without-localsystem/
#
# NOTE: Be sure to run as Admin and restart to take effect.
$svcName = Get-Service -DisplayName *jenkins* | select -Exp Name
$svcKey = Get-Item HKLM:\SYSTEM\CurrentControlSet\Services\$svcName
# Set 9th bit, from http://www.codeproject.com/KB/install/cswindowsservicedesktop.aspx
$newType = $svcKey.GetValue('Type') -bor 0x100
Set-ItemProperty $svcKey.PSPath -Name Type -Value $newType
@cpear
Copy link

cpear commented Apr 26, 2018

Wow. Does this work still with Windows 10?

@andreisuslov
Copy link

Windows 10 - didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment