I dont think you can do that programatically using MAX, but the XP DDK ships with an example called devcon, which is a command line version of the device manager( works only on XP and 2k). It also comes with the source for that utility :).
Check out the following link:
DevconBilal Durrani
NI
Bilal Durrani
NI