Disconnect-XboxController.ps1
function Disconnect-XboxController { <# .Synopsis Simulates the physical disconnect of an Xbox 360 controller. .Description Simulates the physical disconnect of an Xbox 360 controller. .Example Disconnect-XboxController .Parameter Player The Number of the Player (1-4) #> param( [ValidateRange(1, 4)] [int]$Player ) $null = $xbdm::DmAutomationBindController($player - 1, 0) $result = ($xbdm)::DmAutomationDisconnectController($player - 1) if ($Result) { Write-Error ($xbdm)::DmTranslateError($Result) } $null = $xbdm::DmAutomationUnbindController($player - 1, 0) } |