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.
SBSWindows Server 2008

Avatar of undefined
Last Comment
donpick

8/22/2022 - Mon
Qlemo

Didn't try if it works with vssadmin, but usually you just write
   echo y| vssadmin delete shadows /all
Davis McCarn

Or vssadmin delete shadows /all << Y should feed the Y answer to the command.
Qlemo

Nope, Davis, there is no << in Windows.
Your help has saved me hundreds of hours of internet surfing.
fblack61
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
jrhelgeson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Davis McCarn

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.
jrhelgeson

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
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.