Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Disable a Device

 Keywords: disable modem device

Question:

Does anyone know how to disable a device(like a modem) under WINDOWS 2000 with a Winbatch Script, during startup of Windows without showing up for the user?

Thanks for any hint or tip.

Answer:

One way may be to use the Win32 Network Extender.

If you just want to disable the modem use:

AddExtender("WWWNT34i.DLL")
wntSvcCfgSet("", "Modem", 1000, 1, 4)

To also stop it use:

wntSvcControl("", "Modem", 1000, 1)

You can test the current state (started or not) with wntSvcStatus, and test its start type with wntSvcCfgGet.

For both, the user must have the appropriate rights. You could use wntRunAsUser or RunWithLogon to run the script as an admin if the user does not have the proper rights.

Or you could grant so that "Authenticated Users" have WRITE rights to:

HLKM\System\CurrentControlSet\Services\Modem

Changing the "Start" value under this key disables the modem. If it has not started already this should prevent it from starting.