Here is some sample code on how to do this.
AutoIT:
$nController = 1
$XInputDLL = DllOpen("xinput1_3.dll")
DllCall($XInputDLL, "long", 103, "int", $nController)
C++:
#include <windows.h>
#include <iostream>
#include "C:/Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Include\\XInput.h"
#pragma comment(lib, "C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Lib\\x64\\XInput.lib")
using namespace std;
typedef int (*FnOff)(int);
int wmain() {
HINSTANCE hXInputDLL = LoadLibraryA("XInput1_3.dll");
if (hXInputDLL == NULL) {
cout << "ERROR: Unable to load XInput1_3.dll!" << endl;
fgetc(stdin);
return 1;
}
unsigned result;
for (short i = 0; i < XUSER_MAX_COUNT; ++i) {
XINPUT_STATE state;
memset(&state, 0, sizeof(XINPUT_STATE));
result = XInputGetState(i, &state);
if(result == ERROR_SUCCESS) {
FnOff pOff;
pOff = FnOff(GetProcAddress(hXInputDLL, reinterpret_cast<char*>(103)));
pOff(i);
}
}
FreeLibrary(hXInputDLL);
return 0;
}This C++ Code simply turns off all connected XInput devices.
You can probably safely skip the XInputGetState stuff though I have not tried calling XInput1_3.dll#103 on a device that is not connected. I'm sure it will be fine.

Find content
Not Telling