WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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.


Article ID:   W15510
File Created: 2003:05:13:11:28:26
Last Updated: 2003:05:13:11:28:26