How deactivate-reactivate a hardware component and start a service by script / command-line ?

Posted: 01-22-2009, 10:04 AM

Hi,

have my USB Wireless dongle constatntly dropping ( although drivers ok and
up-to-date, constantly awake etc)

Have to deactivate it, re-activate it and start a services which it relies
on to most often regain connetcion to the web.

Doing theses maneuvers is tedious so I am looking for a simpler way to
achieve it with one click on a batch or script

Possible ?

The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink
drivers)

TIA


How deactivate-reactivate a hardware component and start a service by script / command-line ?


Responses to "How deactivate-reactivate a hardware component and start a service by script / command-line ?"

Pegasus \(MVP\)
Guest
Posts: n/a
 
Re: How deactivate-reactivate a hardware component and start a service by script / command-line ?
Posted: 01-22-2009, 10:07 AM


"MoiMeme" <antispam@no.spam> wrote in message
news:%23fuetfHfJHA.5408@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> have my USB Wireless dongle constatntly dropping ( although drivers ok and
> up-to-date, constantly awake etc)
>
> Have to deactivate it, re-activate it and start a services which it relies
> on to most often regain connetcion to the web.
>
> Doing theses maneuvers is tedious so I am looking for a simpler way to
> achieve it with one click on a batch or script
>
> Possible ?
>
> The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink
> drivers)
>
> TIA
Hard to say. Perhaps stopping, then restarting the service would be
sufficient. With my own USB dongle the commands would be:
@echo off
net stop ANIWZCSdService
net start ANIWZCSdService


MoiMeme
Guest
Posts: n/a
 
Re: How deactivate-reactivate a hardware component and start a service by script / command-line ?
Posted: 01-22-2009, 11:15 AM

Ok for the service. That works.

But most often I have to deactivate the dongle in hardware manager, the
reactivate it .

Can that be done as well ?

( Soory for direct reply ! was not intended so !)

"Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:
%23eUT7kHfJHA.2384@TK2MSFTNGP04.phx.gbl...
>
> "MoiMeme" <antispam@no.spam> wrote in message
> news:%23fuetfHfJHA.5408@TK2MSFTNGP03.phx.gbl...
>> Hi,
>>
>> have my USB Wireless dongle constatntly dropping ( although drivers ok
>> and up-to-date, constantly awake etc)
>>
>> Have to deactivate it, re-activate it and start a services which it
>> relies on to most often regain connetcion to the web.
>>
>> Doing theses maneuvers is tedious so I am looking for a simpler way to
>> achieve it with one click on a batch or script
>>
>> Possible ?
>>
>> The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink
>> drivers)
>>
>> TIA
>
> Hard to say. Perhaps stopping, then restarting the service would be
> sufficient. With my own USB dongle the commands would be:
> @echo off
> net stop ANIWZCSdService
> net start ANIWZCSdService
>
>

Pegasus \(MVP\)
Guest
Posts: n/a
 
Re: How deactivate-reactivate a hardware component and start a service by script / command-line ?
Posted: 01-22-2009, 12:11 PM
Here is a batch file that can enable/disable a device. You invoke it with a
parameter of "enable" or "disable".
@echo off
if /i "%1"=="enable" goto start
if /i "%1"=="disable" goto start
goto :eof

:Start
setlocal enabledelayedexpansion
set Desc=Name: USB Mass Storage Device
set HWID=x
set count=0
set found=no

devcon hwids "usb\vid*" > c:\usb.txt
for /F "tokens=*" %%* in (c:\usb.txt) do (
set /a count=!count! + 1
if /i "%%*"=="%Desc%" set found=yes& set count=1
if !found!==yes if !count!==4 set HWID=%%*
)
echo HWID=!HWID!
devcon %1 "!HWID!"
endlocal
del c:\usb.txt

By setting Desc=Name: USB Mass Storage Device in the batch file, it will
enable/disable a USB-connected disk. Your challenge is to find the
appropriate description for your wireless dongle. You can do it like so:
- Execute these commands from a Command Prompt:
devcon hwids "usb\vid*" > c:\usb.txt
notepad c:\usb.txt
- Look for an identifier for your dongle.

You can download devcon.exe from here:
http://download.microsoft.com/downlo...240/devcon.exe


"MoiMeme" <antispam@no.spam> wrote in message
news:%23NoQsHIfJHA.5408@TK2MSFTNGP03.phx.gbl...
> Ok for the service. That works.
>
> But most often I have to deactivate the dongle in hardware manager, the
> reactivate it .
>
> Can that be done as well ?
>
> ( Soory for direct reply ! was not intended so !)
>
> "Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:
> %23eUT7kHfJHA.2384@TK2MSFTNGP04.phx.gbl...
>>
>> "MoiMeme" <antispam@no.spam> wrote in message
>> news:%23fuetfHfJHA.5408@TK2MSFTNGP03.phx.gbl...
>>> Hi,
>>>
>>> have my USB Wireless dongle constatntly dropping ( although drivers ok
>>> and up-to-date, constantly awake etc)
>>>
>>> Have to deactivate it, re-activate it and start a services which it
>>> relies on to most often regain connetcion to the web.
>>>
>>> Doing theses maneuvers is tedious so I am looking for a simpler way to
>>> achieve it with one click on a batch or script
>>>
>>> Possible ?
>>>
>>> The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink
>>> drivers)
>>>
>>> TIA
>>
>> Hard to say. Perhaps stopping, then restarting the service would be
>> sufficient. With my own USB dongle the commands would be:
>> @echo off
>> net stop ANIWZCSdService
>> net start ANIWZCSdService
>>
>>
>
>

MoiMeme
Guest
Posts: n/a
 
Re: How deactivate-reactivate a hardware component and start a service by script / command-line ?
Posted: 01-22-2009, 01:34 PM

Thanks. That works fine !

Many thanks again.

"Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:
e$VHaqIfJHA.500@TK2MSFTNGP06.phx.gbl...
> Here is a batch file that can enable/disable a device. You invoke it with
> a parameter of "enable" or "disable".
> @echo off
> if /i "%1"=="enable" goto start
> if /i "%1"=="disable" goto start
> goto :eof
>
> :Start
> setlocal enabledelayedexpansion
> set Desc=Name: USB Mass Storage Device
> set HWID=x
> set count=0
> set found=no
>
> devcon hwids "usb\vid*" > c:\usb.txt
> for /F "tokens=*" %%* in (c:\usb.txt) do (
> set /a count=!count! + 1
> if /i "%%*"=="%Desc%" set found=yes& set count=1
> if !found!==yes if !count!==4 set HWID=%%*
> )
> echo HWID=!HWID!
> devcon %1 "!HWID!"
> endlocal
> del c:\usb.txt
>
> By setting Desc=Name: USB Mass Storage Device in the batch file, it will
> enable/disable a USB-connected disk. Your challenge is to find the
> appropriate description for your wireless dongle. You can do it like so:
> - Execute these commands from a Command Prompt:
> devcon hwids "usb\vid*" > c:\usb.txt
> notepad c:\usb.txt
> - Look for an identifier for your dongle.
>
> You can download devcon.exe from here:
> http://download.microsoft.com/downlo...240/devcon.exe
>
>
> "MoiMeme" <antispam@no.spam> wrote in message
> news:%23NoQsHIfJHA.5408@TK2MSFTNGP03.phx.gbl...
>> Ok for the service. That works.
>>
>> But most often I have to deactivate the dongle in hardware manager, the
>> reactivate it .
>>
>> Can that be done as well ?
>>
>> ( Soory for direct reply ! was not intended so !)
>>
>> "Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:
>> %23eUT7kHfJHA.2384@TK2MSFTNGP04.phx.gbl...
>>>
>>> "MoiMeme" <antispam@no.spam> wrote in message
>>> news:%23fuetfHfJHA.5408@TK2MSFTNGP03.phx.gbl...
>>>> Hi,
>>>>
>>>> have my USB Wireless dongle constatntly dropping ( although drivers ok
>>>> and up-to-date, constantly awake etc)
>>>>
>>>> Have to deactivate it, re-activate it and start a services which it
>>>> relies on to most often regain connetcion to the web.
>>>>
>>>> Doing theses maneuvers is tedious so I am looking for a simpler way to
>>>> achieve it with one click on a batch or script
>>>>
>>>> Possible ?
>>>>
>>>> The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink
>>>> drivers)
>>>>
>>>> TIA
>>>
>>> Hard to say. Perhaps stopping, then restarting the service would be
>>> sufficient. With my own USB dongle the commands would be:
>>> @echo off
>>> net stop ANIWZCSdService
>>> net start ANIWZCSdService
>>>
>>>
>>
>>
>
>

 
LinkBack Thread Tools Display Modes
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Component named problem for CMI Command line Tool best6553@gmail.com Windows XP Embedded 2 02-06-2009 01:01 PM
Server Command Line Tools component Henry Markov Windows XP Embedded 0 06-27-2008 08:13 PM
NET START STOP Service Command Line Dr. Network Windows Vista 3 09-27-2006 02:17 AM
Command Line and/or Script to Create Default User profile? Shenan Stanley Windows XP Setup 9 04-26-2004 09:10 PM
Delete Hardware Profile via command line Gregg Windows XP Hardware 0 01-26-2004 03:18 PM