Link to home
Start Free TrialLog in
Avatar of donpick
donpick

asked on

How to get vssadmin delete shadows /all to run in a batch file

Running Small Business Server 2008 on a HP ML350 G5 server.
The 3rd party backup fails often with the error:  “Failed to Create Volume Snapshot.  Result code :  0x0042313”

I have found if I execute the command:
  vssadmin delete shadows /all

This command will fix the problem.  

Question:  I'd like to run this as a batch file.  The batch file will execute the   vssadmin delete shadows /all
   command.  The   vssadmin command asks a question when it executes.  In my batch file I placed the letter Y under the command to run   vssadmin .   It seems   vssadmin does not see the Y  so it just sits there waiting for something to enter the letter Y.

I am not a script expert.  What script would you suggest I write so the   vssadmin delete shadows /all   will see the letter Y and run to completion?

Thank you for your help.
Avatar of Qlemo
Qlemo
Flag of Germany image

Didn't try if it works with vssadmin, but usually you just write
   echo y| vssadmin delete shadows /all
Or vssadmin delete shadows /all << Y should feed the Y answer to the command.
Nope, Davis, there is no << in Windows.
Avatar of donpick
donpick

ASKER

Hello Qlemo:
  The command you suggest does not work.
The error message is "invalid command"
Then a list of "Commands Supported" follows

Is there a way to do this with vbscript or something else?
ASKER CERTIFIED SOLUTION
Avatar of jrhelgeson
jrhelgeson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you run the file as an administrator?

I wish you had run the list option to show the shadow copies as still there before you deleted them.
I figured the fact it showed "Do you really want to delete 42 shadow copies (Y/N)" shows that there were 42 shadow copies prior to deleting them.  I figured that was sufficient rather than showing lots of irrelevant information.
Avatar of donpick

ASKER

Hello jrhelgeson

Excellent work!   Your solution works.  This is great, I don't have to do this manually anymore.

Hello DavisMcCarn:  Yes, I created a batch file with the commands specified by  jrhelgeson .  I opened a Command window having administrative privileges .  I ran  jrhelgeson command and it works.

So now I will schedule the execution of  the batch file and have it log in as adminstrator.

Thanks again for helping me.  I pay to use Experts – Exchange so prompt and correct answers are greatly appreciated.