Jump to content
Sign in to follow this  
sakshi

Stop Services

Recommended Posts

sakshi

I am automating some task in which i need to stop all the Oracle services which are running.

I have used

RunWait(@ComSpec & " /c " & 'sc stop "' & $sSvcName1 & '"', "", @SW_HIDE)

but the issue is the service name changes each time .

it is according to the database created but always starts with Oracle keyword.

so i am thinking of stoping all services that start with keyword Oracle.

but dont know how to....

can anyone help Please?

thanks.

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

one way would be

Using this

ConsoleWrite( _getDOSOutput('sc query') & @CRLF)

Func _getDOSOutput($command)
    Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
    While 1
        $text &= StdoutRead($Pid, False, False)
        If @error Then ExitLoop
        Sleep(10)
    WEnd
    Return $text
EndFunc ;==>_getDOSOutput

to get all runnning service, then using RegExp to get the ones which contain the word Orcale and then using e.g. net stop to stop them

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
sakshi

thanks i tried it but now i have issue with StringRegExp

if you could tell how to seacrh for services starting with oracle.

thanks anyway.

Share this post


Link to post
Share on other sites
Xenobiologist

No problem, if you post the output of my code posted before.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
sakshi

here is a screen shot of the output . i have used a msgbox to view output.

http://mbf.me/EBBu

Share this post


Link to post
Share on other sites
Xenobiologist

here is a screen shot of the output . i have used a msgbox to view output.

http://mbf.me/EBBu

There is nothing with the word Oracle in the screenshot. :idea:


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.