Discussion:
I need to Automate ForceFree-Tape cmdlet
(too old to reply)
Victor Asuquo
2009-07-18 05:47:23 UTC
Permalink
I run DPM for backup and I take full daily backup of protection groups
daily. This involves rotating take include previously used one. Each time I
insert a new tape, I have to run this command

ForceFree-Tape.ps1 -DPMServerName MYDPMSERVER1 -LibraryName "Hewlett Packard
LTO Ultrium-3 drive" -TapeLocationList drive-\\.\TapeXXXXXXXX

I need a way to automate this and schedule it to runn daily. I have
researched this and came up with this solution that involves calling the
powershell script from a batch file that is written like this

powershell -command "& 'C:\ForceFree-Tape.ps1'"

I have schedule this batch file now to run daily at a set time. Testing this
fails but running the script directly from DPM Management shell works fine
however.

I need a way to get this script to running daily at a specific time. I need
help and all clues will be appreciated

Thanks in Advance
Rob Campbell
2009-07-18 13:41:01 UTC
Permalink
When a process works from the command line, but fails when run as a scheduled
task, I usually look for permission issues with the account or accounts that
are being used.

If you're using a different account for the scheduled process, does it have
the same permissions to the objects the script is handling as the one that
was used interactively?

Does the account that's being used for the scheduled process have "logon as
batch" rights on the machine where it is being run?
Post by Victor Asuquo
I run DPM for backup and I take full daily backup of protection groups
daily. This involves rotating take include previously used one. Each time I
insert a new tape, I have to run this command
ForceFree-Tape.ps1 -DPMServerName MYDPMSERVER1 -LibraryName "Hewlett Packard
LTO Ultrium-3 drive" -TapeLocationList drive-\\.\TapeXXXXXXXX
I need a way to automate this and schedule it to runn daily. I have
researched this and came up with this solution that involves calling the
powershell script from a batch file that is written like this
powershell -command "& 'C:\ForceFree-Tape.ps1'"
I have schedule this batch file now to run daily at a set time. Testing this
fails but running the script directly from DPM Management shell works fine
however.
I need a way to get this script to running daily at a specific time. I need
help and all clues will be appreciated
Thanks in Advance
Pegasus [MVP]
2009-07-18 14:36:55 UTC
Permalink
Post by Rob Campbell
When a process works from the command line, but fails when run as a scheduled
task, I usually look for permission issues with the account or accounts that
are being used.
A further and often overlooked cause for such problems is "casual"
programming practices: Instead of fully qualifying all commands and files,
people tend to make assumptions that turn out to be invalid. In the current
case the OP assumes that the location of powershell.exe is listed in the
%path%. Perhaps it isn't. Robust programs would use code like this one:
"c:\Program Files\PowerShell\Powershell.exe" -command "&
'C:\ForceFree-Tape.ps1'".
Rob Campbell
2009-07-18 13:46:06 UTC
Permalink
Another possibility is that your console has a profile that's loading a
pssnapin with cmdlets the script uses, but the scheduled task isn't adding
that pssnapin.
Post by Victor Asuquo
I run DPM for backup and I take full daily backup of protection groups
daily. This involves rotating take include previously used one. Each time I
insert a new tape, I have to run this command
ForceFree-Tape.ps1 -DPMServerName MYDPMSERVER1 -LibraryName "Hewlett Packard
LTO Ultrium-3 drive" -TapeLocationList drive-\\.\TapeXXXXXXXX
I need a way to automate this and schedule it to runn daily. I have
researched this and came up with this solution that involves calling the
powershell script from a batch file that is written like this
powershell -command "& 'C:\ForceFree-Tape.ps1'"
I have schedule this batch file now to run daily at a set time. Testing this
fails but running the script directly from DPM Management shell works fine
however.
I need a way to get this script to running daily at a specific time. I need
help and all clues will be appreciated
Thanks in Advance
David Allen
2009-07-20 23:07:01 UTC
Permalink
Hi Victor,

As well as the suggestions already posted to get you your scheduled task
running, you could use Operations Manager to perform this for you if you have
it in your environment.

I have a post that might be useful to you if this is an option
http://www.scdpmonline.org/creating-dpm-powershell-tasks-in-operations-manager.aspx
--
David Allen
MVP - Operations Manager 2007
http://wmug.co.uk/blogs/aquilaweb
http://www.scdpmonline.org
Post by Victor Asuquo
I run DPM for backup and I take full daily backup of protection groups
daily. This involves rotating take include previously used one. Each time I
insert a new tape, I have to run this command
ForceFree-Tape.ps1 -DPMServerName MYDPMSERVER1 -LibraryName "Hewlett Packard
LTO Ultrium-3 drive" -TapeLocationList drive-\\.\TapeXXXXXXXX
I need a way to automate this and schedule it to runn daily. I have
researched this and came up with this solution that involves calling the
powershell script from a batch file that is written like this
powershell -command "& 'C:\ForceFree-Tape.ps1'"
I have schedule this batch file now to run daily at a set time. Testing this
fails but running the script directly from DPM Management shell works fine
however.
I need a way to get this script to running daily at a specific time. I need
help and all clues will be appreciated
Thanks in Advance
Jonesy
2009-07-21 13:06:04 UTC
Permalink
You need to run:

C:\Windows\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile
"C:\Program Files\Microsoft DPM\DPM\bin\dpmshell.psc1" -noexit -command
"C:\ForceFree-Tape.ps1"
Post by Victor Asuquo
I run DPM for backup and I take full daily backup of protection groups
daily. This involves rotating take include previously used one. Each time I
insert a new tape, I have to run this command
ForceFree-Tape.ps1 -DPMServerName MYDPMSERVER1 -LibraryName "Hewlett Packard
LTO Ultrium-3 drive" -TapeLocationList drive-\\.\TapeXXXXXXXX
I need a way to automate this and schedule it to runn daily. I have
researched this and came up with this solution that involves calling the
powershell script from a batch file that is written like this
powershell -command "& 'C:\ForceFree-Tape.ps1'"
I have schedule this batch file now to run daily at a set time. Testing this
fails but running the script directly from DPM Management shell works fine
however.
I need a way to get this script to running daily at a specific time. I need
help and all clues will be appreciated
Thanks in Advance
VascoSputs
2009-07-23 16:38:04 UTC
Permalink
Thanks Guys, especially to Jonesy. I created a batch file with the command
you provided running the batch fle works, so scheduling this to run, I expect
complete success, the only little glitch there is that, the command prompt
window, does not close at the end of execution. This I attribute to the
-noexit parameter, or what do you think?
--
EdemObong
Post by Jonesy
C:\Windows\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile
"C:\Program Files\Microsoft DPM\DPM\bin\dpmshell.psc1" -noexit -command
"C:\ForceFree-Tape.ps1"
Post by Victor Asuquo
I run DPM for backup and I take full daily backup of protection groups
daily. This involves rotating take include previously used one. Each time I
insert a new tape, I have to run this command
ForceFree-Tape.ps1 -DPMServerName MYDPMSERVER1 -LibraryName "Hewlett Packard
LTO Ultrium-3 drive" -TapeLocationList drive-\\.\TapeXXXXXXXX
I need a way to automate this and schedule it to runn daily. I have
researched this and came up with this solution that involves calling the
powershell script from a batch file that is written like this
powershell -command "& 'C:\ForceFree-Tape.ps1'"
I have schedule this batch file now to run daily at a set time. Testing this
fails but running the script directly from DPM Management shell works fine
however.
I need a way to get this script to running daily at a specific time. I need
help and all clues will be appreciated
Thanks in Advance
Jonesy
2009-07-24 07:03:02 UTC
Permalink
Not a problem. Removing noexit should do the trick.
Post by VascoSputs
Thanks Guys, especially to Jonesy. I created a batch file with the command
you provided running the batch fle works, so scheduling this to run, I expect
complete success, the only little glitch there is that, the command prompt
window, does not close at the end of execution. This I attribute to the
-noexit parameter, or what do you think?
--
EdemObong
Post by Jonesy
C:\Windows\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile
"C:\Program Files\Microsoft DPM\DPM\bin\dpmshell.psc1" -noexit -command
"C:\ForceFree-Tape.ps1"
Post by Victor Asuquo
I run DPM for backup and I take full daily backup of protection groups
daily. This involves rotating take include previously used one. Each time I
insert a new tape, I have to run this command
ForceFree-Tape.ps1 -DPMServerName MYDPMSERVER1 -LibraryName "Hewlett Packard
LTO Ultrium-3 drive" -TapeLocationList drive-\\.\TapeXXXXXXXX
I need a way to automate this and schedule it to runn daily. I have
researched this and came up with this solution that involves calling the
powershell script from a batch file that is written like this
powershell -command "& 'C:\ForceFree-Tape.ps1'"
I have schedule this batch file now to run daily at a set time. Testing this
fails but running the script directly from DPM Management shell works fine
however.
I need a way to get this script to running daily at a specific time. I need
help and all clues will be appreciated
Thanks in Advance
Loading...