Home All Groups Group Topic Archive Search About

Stop windows service copy data and then start service

Author
11 May 2009 9:52 PM
Masti
Hi,
I need a vbscript which can stop a windows service and copy data and once
the data is copied over restart the service. This has be done from remote
server and for multiple servers.

Any help is appreciated.

Author
11 May 2009 10:58 PM
Pegasus [MVP]
"Masti" <Ma***@discussions.microsoft.com> wrote in message
news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
> Hi,
> I need a vbscript which can stop a windows service and copy data and once
> the data is copied over restart the service. This has be done from remote
> server and for multiple servers.
>
> Any help is appreciated.

The easiest way to achieve this is by using a batch file:
@echo off
sc \\SomeServer stop SomeService
robocopy /s SourceDir TargetDir
sc \\SomeServer start SomeService

If you must use a VB Script then you can use the Run method in order to
execute the two sc.exe commands.
Author
11 May 2009 11:07 PM
Masti
Hi,

Reason why i asked for vbcript is i need to schedule this task and leave it
so it runs every weekend. Can you provide me with compelte script?

Thanks

Show quoteHide quote
"Pegasus [MVP]" wrote:

>
> "Masti" <Ma***@discussions.microsoft.com> wrote in message
> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
> > Hi,
> > I need a vbscript which can stop a windows service and copy data and once
> > the data is copied over restart the service. This has be done from remote
> > server and for multiple servers.
> >
> > Any help is appreciated.
>
> The easiest way to achieve this is by using a batch file:
> @echo off
> sc \\SomeServer stop SomeService
> robocopy /s SourceDir TargetDir
> sc \\SomeServer start SomeService
>
> If you must use a VB Script then you can use the Run method in order to
> execute the two sc.exe commands.
>
>
>
Author
12 May 2009 12:54 AM
Al Dunbar
"Masti" <Ma***@discussions.microsoft.com> wrote in message
news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
> Hi,
>
> Reason why i asked for vbcript is i need to schedule this task and leave
> it
> so it runs every weekend.

You don't need vbscript to do that, as you can schedule batch files.

/Al

Show quoteHide quote
>    Can you provide me with compelte script?
>
> Thanks
>
> "Pegasus [MVP]" wrote:
>
>>
>> "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
>> > Hi,
>> > I need a vbscript which can stop a windows service and copy data and
>> > once
>> > the data is copied over restart the service. This has be done from
>> > remote
>> > server and for multiple servers.
>> >
>> > Any help is appreciated.
>>
>> The easiest way to achieve this is by using a batch file:
>> @echo off
>> sc \\SomeServer stop SomeService
>> robocopy /s SourceDir TargetDir
>> sc \\SomeServer start SomeService
>>
>> If you must use a VB Script then you can use the Run method in order to
>> execute the two sc.exe commands.
>>
>>
>>
Author
15 May 2009 4:21 PM
Masti
Hi,

can you tell me what is the run method, actually this is what i am planning
to do .
we are using netbackup to backup UDDI files. but as some of the files are in
open state most of the time the backup software was not able to backup open
files.we dont have an open file agent license . so i need a script  Do the
following:

Stop the service MSSQL$UDDI
Copy the folder C:\Inetpub\uddi to a backup location
Restart MSSQL$UDDI

Please provide me a script

any help appreciated , thank you .

Masti
Show quoteHide quote
"Al Dunbar" wrote:

>
> "Masti" <Ma***@discussions.microsoft.com> wrote in message
> news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
> > Hi,
> >
> > Reason why i asked for vbcript is i need to schedule this task and leave
> > it
> > so it runs every weekend.
>
> You don't need vbscript to do that, as you can schedule batch files.
>
> /Al
>
> >    Can you provide me with compelte script?
> >
> > Thanks
> >
> > "Pegasus [MVP]" wrote:
> >
> >>
> >> "Masti" <Ma***@discussions.microsoft.com> wrote in message
> >> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
> >> > Hi,
> >> > I need a vbscript which can stop a windows service and copy data and
> >> > once
> >> > the data is copied over restart the service. This has be done from
> >> > remote
> >> > server and for multiple servers.
> >> >
> >> > Any help is appreciated.
> >>
> >> The easiest way to achieve this is by using a batch file:
> >> @echo off
> >> sc \\SomeServer stop SomeService
> >> robocopy /s SourceDir TargetDir
> >> sc \\SomeServer start SomeService
> >>
> >> If you must use a VB Script then you can use the Run method in order to
> >> execute the two sc.exe commands.
> >>
> >>
> >>
>
>
>
Author
15 May 2009 4:31 PM
Pegasus [MVP]
Download the help file "script56.chm" from the Microsoft site, then check
what it says about the "run" method.

Show quoteHide quote
"Masti" <Ma***@discussions.microsoft.com> wrote in message
news:3FC5A218-57B3-4D07-9918-622FA80C819E@microsoft.com...
> Hi,
>
> can you tell me what is the run method, actually this is what i am
> planning
> to do .
> we are using netbackup to backup UDDI files. but as some of the files are
> in
> open state most of the time the backup software was not able to backup
> open
> files.we dont have an open file agent license . so i need a script  Do the
> following:
>
> Stop the service MSSQL$UDDI
> Copy the folder C:\Inetpub\uddi to a backup location
> Restart MSSQL$UDDI
>
> Please provide me a script
>
> any help appreciated , thank you .
>
> Masti
> "Al Dunbar" wrote:
>
>>
>> "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
>> > Hi,
>> >
>> > Reason why i asked for vbcript is i need to schedule this task and
>> > leave
>> > it
>> > so it runs every weekend.
>>
>> You don't need vbscript to do that, as you can schedule batch files.
>>
>> /Al
>>
>> >    Can you provide me with compelte script?
>> >
>> > Thanks
>> >
>> > "Pegasus [MVP]" wrote:
>> >
>> >>
>> >> "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> >> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
>> >> > Hi,
>> >> > I need a vbscript which can stop a windows service and copy data and
>> >> > once
>> >> > the data is copied over restart the service. This has be done from
>> >> > remote
>> >> > server and for multiple servers.
>> >> >
>> >> > Any help is appreciated.
>> >>
>> >> The easiest way to achieve this is by using a batch file:
>> >> @echo off
>> >> sc \\SomeServer stop SomeService
>> >> robocopy /s SourceDir TargetDir
>> >> sc \\SomeServer start SomeService
>> >>
>> >> If you must use a VB Script then you can use the Run method in order
>> >> to
>> >> execute the two sc.exe commands.
>> >>
>> >>
>> >>
>>
>>
>>
Author
18 May 2009 4:21 PM
Masti
Hi,
I tried the script you provided but it failed to stop the service and copy
files and start service.

here is the script i used:
@echo off
sc \\Servername stop MSSQL$UDDI
robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
sc \\Servername  start MSSQL$UDDI

Can you please let me know if am doing or using any syntax or command wrong
here in the script. I created this as a batch file and did schedule it for
run .

Thanks

Masti



Show quoteHide quote
"Masti" wrote:

> Hi,
>
> can you tell me what is the run method, actually this is what i am planning
> to do .
> we are using netbackup to backup UDDI files. but as some of the files are in
> open state most of the time the backup software was not able to backup open
> files.we dont have an open file agent license . so i need a script  Do the
> following:
>
> Stop the service MSSQL$UDDI
> Copy the folder C:\Inetpub\uddi to a backup location
> Restart MSSQL$UDDI
>
> Please provide me a script
>
> any help appreciated , thank you .
>
> Masti
> "Al Dunbar" wrote:
>
> >
> > "Masti" <Ma***@discussions.microsoft.com> wrote in message
> > news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
> > > Hi,
> > >
> > > Reason why i asked for vbcript is i need to schedule this task and leave
> > > it
> > > so it runs every weekend.
> >
> > You don't need vbscript to do that, as you can schedule batch files.
> >
> > /Al
> >
> > >    Can you provide me with compelte script?
> > >
> > > Thanks
> > >
> > > "Pegasus [MVP]" wrote:
> > >
> > >>
> > >> "Masti" <Ma***@discussions.microsoft.com> wrote in message
> > >> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
> > >> > Hi,
> > >> > I need a vbscript which can stop a windows service and copy data and
> > >> > once
> > >> > the data is copied over restart the service. This has be done from
> > >> > remote
> > >> > server and for multiple servers.
> > >> >
> > >> > Any help is appreciated.
> > >>
> > >> The easiest way to achieve this is by using a batch file:
> > >> @echo off
> > >> sc \\SomeServer stop SomeService
> > >> robocopy /s SourceDir TargetDir
> > >> sc \\SomeServer start SomeService
> > >>
> > >> If you must use a VB Script then you can use the Run method in order to
> > >> execute the two sc.exe commands.
> > >>
> > >>
> > >>
> >
> >
> >
Author
18 May 2009 6:51 PM
Pegasus [MVP]
When you write a batch file then it is a little optimistic to run it under
the Task Scheduler without first testing it extensively in a Command Prompt.
Perhaps you'll get some error message saying that the service cannot be
stopped for one reason or the other. At the very least you should include
some logging code in your batch file, e.g. like so:
@echo off
echo %date% %time% %UserName% >> c:\test.txt
sc \\Servername stop MSSQL$UDDI 1>>c:\test.txt 2>>&1
robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
sc \\Servername  start MSSQL$UDDI 1>>c:\test.txt 2>>&1

A frequently overlooked cause of failure for scheduled batch files is that
the account used by the Task Scheduler has insufficient access rights to the
resource it is trying to access.


Show quoteHide quote
"Masti" <Ma***@discussions.microsoft.com> wrote in message
news:0E10899F-7F76-49B9-A872-C9ADE880B6C2@microsoft.com...
> Hi,
> I tried the script you provided but it failed to stop the service and copy
> files and start service.
>
> here is the script i used:
> @echo off
> sc \\Servername stop MSSQL$UDDI
> robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
> sc \\Servername  start MSSQL$UDDI
>
> Can you please let me know if am doing or using any syntax or command
> wrong
> here in the script. I created this as a batch file and did schedule it for
> run .
>
> Thanks
>
> Masti
>
>
>
> "Masti" wrote:
>
>> Hi,
>>
>> can you tell me what is the run method, actually this is what i am
>> planning
>> to do .
>> we are using netbackup to backup UDDI files. but as some of the files are
>> in
>> open state most of the time the backup software was not able to backup
>> open
>> files.we dont have an open file agent license . so i need a script  Do
>> the
>> following:
>>
>> Stop the service MSSQL$UDDI
>> Copy the folder C:\Inetpub\uddi to a backup location
>> Restart MSSQL$UDDI
>>
>> Please provide me a script
>>
>> any help appreciated , thank you .
>>
>> Masti
>> "Al Dunbar" wrote:
>>
>> >
>> > "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> > news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
>> > > Hi,
>> > >
>> > > Reason why i asked for vbcript is i need to schedule this task and
>> > > leave
>> > > it
>> > > so it runs every weekend.
>> >
>> > You don't need vbscript to do that, as you can schedule batch files.
>> >
>> > /Al
>> >
>> > >    Can you provide me with compelte script?
>> > >
>> > > Thanks
>> > >
>> > > "Pegasus [MVP]" wrote:
>> > >
>> > >>
>> > >> "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> > >> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
>> > >> > Hi,
>> > >> > I need a vbscript which can stop a windows service and copy data
>> > >> > and
>> > >> > once
>> > >> > the data is copied over restart the service. This has be done from
>> > >> > remote
>> > >> > server and for multiple servers.
>> > >> >
>> > >> > Any help is appreciated.
>> > >>
>> > >> The easiest way to achieve this is by using a batch file:
>> > >> @echo off
>> > >> sc \\SomeServer stop SomeService
>> > >> robocopy /s SourceDir TargetDir
>> > >> sc \\SomeServer start SomeService
>> > >>
>> > >> If you must use a VB Script then you can use the Run method in order
>> > >> to
>> > >> execute the two sc.exe commands.
>> > >>
>> > >>
>> > >>
>> >
>> >
>> >
Author
21 May 2009 8:53 PM
Masti
Hi,

I did run the script it works fine copying data but actually i believe its
not able to stop the service and copy all the data reason is Under UDDI
whatever data is under Data folder is not being copied over.

I see these messages in the log.

Thu 05/21/2009 13:43:20.14 praveen-adm
[SC] OpenSCManager FAILED 1722:

The RPC server is unavailable.

[SC] StartService FAILED 1056:

An instance of the service is already running.

does it make any sense to you .. can you please help me.

Show quoteHide quote
"Pegasus [MVP]" wrote:

> When you write a batch file then it is a little optimistic to run it under
> the Task Scheduler without first testing it extensively in a Command Prompt.
> Perhaps you'll get some error message saying that the service cannot be
> stopped for one reason or the other. At the very least you should include
> some logging code in your batch file, e.g. like so:
> @echo off
> echo %date% %time% %UserName% >> c:\test.txt
> sc \\Servername stop MSSQL$UDDI 1>>c:\test.txt 2>>&1
> robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
> sc \\Servername  start MSSQL$UDDI 1>>c:\test.txt 2>>&1
>
> A frequently overlooked cause of failure for scheduled batch files is that
> the account used by the Task Scheduler has insufficient access rights to the
> resource it is trying to access.
>
>
> "Masti" <Ma***@discussions.microsoft.com> wrote in message
> news:0E10899F-7F76-49B9-A872-C9ADE880B6C2@microsoft.com...
> > Hi,
> > I tried the script you provided but it failed to stop the service and copy
> > files and start service.
> >
> > here is the script i used:
> > @echo off
> > sc \\Servername stop MSSQL$UDDI
> > robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
> > sc \\Servername  start MSSQL$UDDI
> >
> > Can you please let me know if am doing or using any syntax or command
> > wrong
> > here in the script. I created this as a batch file and did schedule it for
> > run .
> >
> > Thanks
> >
> > Masti
> >
> >
> >
> > "Masti" wrote:
> >
> >> Hi,
> >>
> >> can you tell me what is the run method, actually this is what i am
> >> planning
> >> to do .
> >> we are using netbackup to backup UDDI files. but as some of the files are
> >> in
> >> open state most of the time the backup software was not able to backup
> >> open
> >> files.we dont have an open file agent license . so i need a script  Do
> >> the
> >> following:
> >>
> >> Stop the service MSSQL$UDDI
> >> Copy the folder C:\Inetpub\uddi to a backup location
> >> Restart MSSQL$UDDI
> >>
> >> Please provide me a script
> >>
> >> any help appreciated , thank you .
> >>
> >> Masti
> >> "Al Dunbar" wrote:
> >>
> >> >
> >> > "Masti" <Ma***@discussions.microsoft.com> wrote in message
> >> > news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
> >> > > Hi,
> >> > >
> >> > > Reason why i asked for vbcript is i need to schedule this task and
> >> > > leave
> >> > > it
> >> > > so it runs every weekend.
> >> >
> >> > You don't need vbscript to do that, as you can schedule batch files.
> >> >
> >> > /Al
> >> >
> >> > >    Can you provide me with compelte script?
> >> > >
> >> > > Thanks
> >> > >
> >> > > "Pegasus [MVP]" wrote:
> >> > >
> >> > >>
> >> > >> "Masti" <Ma***@discussions.microsoft.com> wrote in message
> >> > >> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
> >> > >> > Hi,
> >> > >> > I need a vbscript which can stop a windows service and copy data
> >> > >> > and
> >> > >> > once
> >> > >> > the data is copied over restart the service. This has be done from
> >> > >> > remote
> >> > >> > server and for multiple servers.
> >> > >> >
> >> > >> > Any help is appreciated.
> >> > >>
> >> > >> The easiest way to achieve this is by using a batch file:
> >> > >> @echo off
> >> > >> sc \\SomeServer stop SomeService
> >> > >> robocopy /s SourceDir TargetDir
> >> > >> sc \\SomeServer start SomeService
> >> > >>
> >> > >> If you must use a VB Script then you can use the Run method in order
> >> > >> to
> >> > >> execute the two sc.exe commands.
> >> > >>
> >> > >>
> >> > >>
> >> >
> >> >
> >> >
>
>
>
Author
21 May 2009 9:14 PM
Masti
I get this eror message now ,

SERVICE_NAME: MSSQL$UDDI
        TYPE               : 10  WIN32_OWN_PROCESS 
        STATE              : 3  STOP_PENDING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x1
        WAIT_HINT          : 0xea60

SERVICE_NAME: MSSQL$UDDI
        TYPE               : 10  WIN32_OWN_PROCESS 
        STATE              : 2  START_PENDING
                                (NOT_STOPPABLE, NOT_PAUSABLE,
IGNORES_SHUTDOWN))
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x7d0
        PID                : 2588
        FLAGS              :

Script is @echo off
echo %date% %time% %UserName% >> c:\test.txt
sc \\ussf-papp-win01 stop MSSQL$UDDI 1>>c:\test.txt 2>>&1
robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
sc \\ussf-papp-win01  start MSSQL$UDDI 1>>c:\test.txt 2>>&1

Please help

Show quoteHide quote
"Masti" wrote:

> Hi,
>
> I did run the script it works fine copying data but actually i believe its
> not able to stop the service and copy all the data reason is Under UDDI
> whatever data is under Data folder is not being copied over.
>
> I see these messages in the log.
>
> Thu 05/21/2009 13:43:20.14 praveen-adm
> [SC] OpenSCManager FAILED 1722:
>
> The RPC server is unavailable.
>
> [SC] StartService FAILED 1056:
>
> An instance of the service is already running.
>
> does it make any sense to you .. can you please help me.
>
> "Pegasus [MVP]" wrote:
>
> > When you write a batch file then it is a little optimistic to run it under
> > the Task Scheduler without first testing it extensively in a Command Prompt.
> > Perhaps you'll get some error message saying that the service cannot be
> > stopped for one reason or the other. At the very least you should include
> > some logging code in your batch file, e.g. like so:
> > @echo off
> > echo %date% %time% %UserName% >> c:\test.txt
> > sc \\Servername stop MSSQL$UDDI 1>>c:\test.txt 2>>&1
> > robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
> > sc \\Servername  start MSSQL$UDDI 1>>c:\test.txt 2>>&1
> >
> > A frequently overlooked cause of failure for scheduled batch files is that
> > the account used by the Task Scheduler has insufficient access rights to the
> > resource it is trying to access.
> >
> >
> > "Masti" <Ma***@discussions.microsoft.com> wrote in message
> > news:0E10899F-7F76-49B9-A872-C9ADE880B6C2@microsoft.com...
> > > Hi,
> > > I tried the script you provided but it failed to stop the service and copy
> > > files and start service.
> > >
> > > here is the script i used:
> > > @echo off
> > > sc \\Servername stop MSSQL$UDDI
> > > robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
> > > sc \\Servername  start MSSQL$UDDI
> > >
> > > Can you please let me know if am doing or using any syntax or command
> > > wrong
> > > here in the script. I created this as a batch file and did schedule it for
> > > run .
> > >
> > > Thanks
> > >
> > > Masti
> > >
> > >
> > >
> > > "Masti" wrote:
> > >
> > >> Hi,
> > >>
> > >> can you tell me what is the run method, actually this is what i am
> > >> planning
> > >> to do .
> > >> we are using netbackup to backup UDDI files. but as some of the files are
> > >> in
> > >> open state most of the time the backup software was not able to backup
> > >> open
> > >> files.we dont have an open file agent license . so i need a script  Do
> > >> the
> > >> following:
> > >>
> > >> Stop the service MSSQL$UDDI
> > >> Copy the folder C:\Inetpub\uddi to a backup location
> > >> Restart MSSQL$UDDI
> > >>
> > >> Please provide me a script
> > >>
> > >> any help appreciated , thank you .
> > >>
> > >> Masti
> > >> "Al Dunbar" wrote:
> > >>
> > >> >
> > >> > "Masti" <Ma***@discussions.microsoft.com> wrote in message
> > >> > news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
> > >> > > Hi,
> > >> > >
> > >> > > Reason why i asked for vbcript is i need to schedule this task and
> > >> > > leave
> > >> > > it
> > >> > > so it runs every weekend.
> > >> >
> > >> > You don't need vbscript to do that, as you can schedule batch files.
> > >> >
> > >> > /Al
> > >> >
> > >> > >    Can you provide me with compelte script?
> > >> > >
> > >> > > Thanks
> > >> > >
> > >> > > "Pegasus [MVP]" wrote:
> > >> > >
> > >> > >>
> > >> > >> "Masti" <Ma***@discussions.microsoft.com> wrote in message
> > >> > >> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
> > >> > >> > Hi,
> > >> > >> > I need a vbscript which can stop a windows service and copy data
> > >> > >> > and
> > >> > >> > once
> > >> > >> > the data is copied over restart the service. This has be done from
> > >> > >> > remote
> > >> > >> > server and for multiple servers.
> > >> > >> >
> > >> > >> > Any help is appreciated.
> > >> > >>
> > >> > >> The easiest way to achieve this is by using a batch file:
> > >> > >> @echo off
> > >> > >> sc \\SomeServer stop SomeService
> > >> > >> robocopy /s SourceDir TargetDir
> > >> > >> sc \\SomeServer start SomeService
> > >> > >>
> > >> > >> If you must use a VB Script then you can use the Run method in order
> > >> > >> to
> > >> > >> execute the two sc.exe commands.
> > >> > >>
> > >> > >>
> > >> > >>
> > >> >
> > >> >
> > >> >
> >
> >
> >
Author
21 May 2009 9:16 PM
Pegasus [MVP]
Sorry, I have never succeeded in stopping a service that the commands "net
stop" or "sc stop" failed to stop.


Show quoteHide quote
"Masti" <Ma***@discussions.microsoft.com> wrote in message
news:3293ED81-FE88-4164-805F-A9519C6EBAEC@microsoft.com...
> Hi,
>
> I did run the script it works fine copying data but actually i believe its
> not able to stop the service and copy all the data reason is Under UDDI
> whatever data is under Data folder is not being copied over.
>
> I see these messages in the log.
>
> Thu 05/21/2009 13:43:20.14 praveen-adm
> [SC] OpenSCManager FAILED 1722:
>
> The RPC server is unavailable.
>
> [SC] StartService FAILED 1056:
>
> An instance of the service is already running.
>
> does it make any sense to you .. can you please help me.
>
> "Pegasus [MVP]" wrote:
>
>> When you write a batch file then it is a little optimistic to run it
>> under
>> the Task Scheduler without first testing it extensively in a Command
>> Prompt.
>> Perhaps you'll get some error message saying that the service cannot be
>> stopped for one reason or the other. At the very least you should include
>> some logging code in your batch file, e.g. like so:
>> @echo off
>> echo %date% %time% %UserName% >> c:\test.txt
>> sc \\Servername stop MSSQL$UDDI 1>>c:\test.txt 2>>&1
>> robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
>> sc \\Servername  start MSSQL$UDDI 1>>c:\test.txt 2>>&1
>>
>> A frequently overlooked cause of failure for scheduled batch files is
>> that
>> the account used by the Task Scheduler has insufficient access rights to
>> the
>> resource it is trying to access.
>>
>>
>> "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> news:0E10899F-7F76-49B9-A872-C9ADE880B6C2@microsoft.com...
>> > Hi,
>> > I tried the script you provided but it failed to stop the service and
>> > copy
>> > files and start service.
>> >
>> > here is the script i used:
>> > @echo off
>> > sc \\Servername stop MSSQL$UDDI
>> > robocopy /s C:\Inetpub\uddi C:\Test_backup_Uddi
>> > sc \\Servername  start MSSQL$UDDI
>> >
>> > Can you please let me know if am doing or using any syntax or command
>> > wrong
>> > here in the script. I created this as a batch file and did schedule it
>> > for
>> > run .
>> >
>> > Thanks
>> >
>> > Masti
>> >
>> >
>> >
>> > "Masti" wrote:
>> >
>> >> Hi,
>> >>
>> >> can you tell me what is the run method, actually this is what i am
>> >> planning
>> >> to do .
>> >> we are using netbackup to backup UDDI files. but as some of the files
>> >> are
>> >> in
>> >> open state most of the time the backup software was not able to backup
>> >> open
>> >> files.we dont have an open file agent license . so i need a script  Do
>> >> the
>> >> following:
>> >>
>> >> Stop the service MSSQL$UDDI
>> >> Copy the folder C:\Inetpub\uddi to a backup location
>> >> Restart MSSQL$UDDI
>> >>
>> >> Please provide me a script
>> >>
>> >> any help appreciated , thank you .
>> >>
>> >> Masti
>> >> "Al Dunbar" wrote:
>> >>
>> >> >
>> >> > "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> >> > news:FF04D9FF-AA60-4332-B8BD-44E2AC30C17D@microsoft.com...
>> >> > > Hi,
>> >> > >
>> >> > > Reason why i asked for vbcript is i need to schedule this task and
>> >> > > leave
>> >> > > it
>> >> > > so it runs every weekend.
>> >> >
>> >> > You don't need vbscript to do that, as you can schedule batch files.
>> >> >
>> >> > /Al
>> >> >
>> >> > >    Can you provide me with compelte script?
>> >> > >
>> >> > > Thanks
>> >> > >
>> >> > > "Pegasus [MVP]" wrote:
>> >> > >
>> >> > >>
>> >> > >> "Masti" <Ma***@discussions.microsoft.com> wrote in message
>> >> > >> news:38F95770-8A51-47A0-97E0-9B82F57A7252@microsoft.com...
>> >> > >> > Hi,
>> >> > >> > I need a vbscript which can stop a windows service and copy
>> >> > >> > data
>> >> > >> > and
>> >> > >> > once
>> >> > >> > the data is copied over restart the service. This has be done
>> >> > >> > from
>> >> > >> > remote
>> >> > >> > server and for multiple servers.
>> >> > >> >
>> >> > >> > Any help is appreciated.
>> >> > >>
>> >> > >> The easiest way to achieve this is by using a batch file:
>> >> > >> @echo off
>> >> > >> sc \\SomeServer stop SomeService
>> >> > >> robocopy /s SourceDir TargetDir
>> >> > >> sc \\SomeServer start SomeService
>> >> > >>
>> >> > >> If you must use a VB Script then you can use the Run method in
>> >> > >> order
>> >> > >> to
>> >> > >> execute the two sc.exe commands.
>> >> > >>
>> >> > >>
>> >> > >>
>> >> >
>> >> >
>> >> >
>>
>>
>>