obs-powershell.psm1
foreach ($file in (Get-ChildItem -Path "$PSScriptRoot" -Filter "*-*.ps1" -Recurse)) { if ($file.Extension -ne '.ps1') { continue } # Skip if the extension is not .ps1 if ($file.Name -match '\.[^\.]+\.ps1$') { continue } # Skip if the file is an unrelated file. . $file.FullName } $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = { Disconnect-OBS } |