Skip to content

Instantly share code, notes, and snippets.



Created Feb 7, 2021
What would you like to do?
function Test-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$obsFolder = "C:\Program Files\obs-studio"
$windowedBorderlessFolder = "D:\Windowed Borderless"
$windowedBorderlessProcess = Get-Process -Name WindowedBorderlessGaming -ErrorAction SilentlyContinue
$obsProcess = Get-Process -Name obs64 -ErrorAction SilentlyContinue
# stop OBS and WBP if running
if ( $windowedBorderlessProcess -or $obsProcess ) {
if ((Test-Admin) -eq $false) {
if ($elevated) {
# tried to elevate, did not work, aborting
} else {
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
$windowedBorderlessProcess | Stop-Process
$obsProcess | Stop-Process
Start-Process -FilePath WindowedBorderlessGaming.exe -WorkingDirectory $windowedBorderlessFolder
Start-Process -FilePath "obs64.exe" -WorkingDirectory "$obsFolder\bin\64bit"
# open OBS Windowed Projector mode
Add-Type -path "$obsFolder\websocket\obs-websocket-dotnet.dll"
$obs = new-object OBSWebsocketDotNet.OBSWebsocket
$obs.Connect("ws://", "")
# bring Windowed Projector into focus
$wshell = New-Object -ComObject
$wshell.AppActivate('Windowed Projector (Preview)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment