how can i use net stop / net start for a server service from my local app 
Author Message
 how can i use net stop / net start for a server service from my local app

can this be done?


Fri, 11 Jan 2002 03:00:00 GMT  
 how can i use net stop / net start for a server service from my local app
Yep....  It would be something like

Public Function convert(ID as long) as boolean
on error goto errorhandler
Dim strg as string
'You can add code to get the system dir or try the enviroment variable....
but I just wrote a quick example....

Select Case ID
  Case 1  'START
    strg = %22 & "C:\winnt\system32\net.exe START some service" & %22   'I
am not sure what %22 is, but you need the value that = " (quote)  I just
guessed for now.....
  Case 2 'STOP
    strg = %22 & "C:\winnt\system32\net.exe STOP some service" & %22   'I am
not sure what %22 is, but you need the value that = " (quote)  I just
guessed for now.....
  Case else 'WHATEVER
    Msgbox "Nothing Selected!",vbInformation,"Simple Error"
End Select
  Shell strg
  convert = True
exit function
errorhandler:
  convert = False
End Function

Does this help....  Jon

***********************************
You can only get so much for free!  :)



Quote:
> can this be done?



Fri, 11 Jan 2002 03:00:00 GMT  
 how can i use net stop / net start for a server service from my local app
jon, i'm not sure i understand.

the app is running on a win98 workstation.

the server is on another machine.

do i just need to point to the net.exe on the server using unc?

thanks.

Quote:

> Yep....  It would be something like

> Public Function convert(ID as long) as boolean
> on error goto errorhandler
> Dim strg as string
> 'You can add code to get the system dir or try the enviroment variable....
> but I just wrote a quick example....

> Select Case ID
>   Case 1  'START
>     strg = %22 & "C:\winnt\system32\net.exe START some service" & %22   'I
> am not sure what %22 is, but you need the value that = " (quote)  I just
> guessed for now.....
>   Case 2 'STOP
>     strg = %22 & "C:\winnt\system32\net.exe STOP some service" & %22   'I
am
> not sure what %22 is, but you need the value that = " (quote)  I just
> guessed for now.....
>   Case else 'WHATEVER
>     Msgbox "Nothing Selected!",vbInformation,"Simple Error"
> End Select
>   Shell strg
>   convert = True
> exit function
> errorhandler:
>   convert = False
> End Function

> Does this help....  Jon

> ***********************************
> You can only get so much for free!  :)



> > can this be done?



Fri, 11 Jan 2002 03:00:00 GMT  
 how can i use net stop / net start for a server service from my local app
I don't think my suggestion will work with Win 9x....  however, you could
write an ActiveX server that sits on the server and call its methods.  It's
hard to know your requirments when you do not say what they are.

Just another thought,

Jon

*************************************
You can only get so much for free.   :)





Sat, 12 Jan 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VB.Net Service Qustion: Detecting Program Start/Stop

2. Please HELP (Net Stop / Net Start Spooler)

3. Stop/Start the spooling service on servers

4. Using SQL Server Application Roles in a VB.NET web app

5. Timer Stops firing when 2 VB.NET services running

6. Timer stops firing when 2 .net services running on same machine

7. ASP.NET App v. VB.NET App

8. Conversion of VB.Net App to ASP .Net App

9. Start/Stop a NT Service using wsh/adsi

10. ADO.NET with ASP.NET using VB.NET

11. Find good book about using CR.NET with VS.NET and .NET Framework

12. API for NET Start/Stop???

 

 
Powered by phpBB® Forum Software