-
- Novice
- Posts: 4
- Liked: never
- Joined: Sep 11, 2013 8:06 am
- Full Name: Ercan Güven
- Contact:
Possible to assign tape in slot to mediapool?
Hi all,
is it possible via PowerShell Script to assign all unrecognized Tapes to special Mediapools based on the Slot the Tape is in?
Example:
Tape 9 is in Slot 2, so i want it to be in the Tuesday Mediapool. All Slot 2 Tapes should be automatically moved in the Tuesday Mediapool.
I´am not so advanced using the Veeam Power Shell and have no idea how or if i can access the Slotinformation of a Tape.
Any help would be greatly appreciated.
Thank you
is it possible via PowerShell Script to assign all unrecognized Tapes to special Mediapools based on the Slot the Tape is in?
Example:
Tape 9 is in Slot 2, so i want it to be in the Tuesday Mediapool. All Slot 2 Tapes should be automatically moved in the Tuesday Mediapool.
I´am not so advanced using the Veeam Power Shell and have no idea how or if i can access the Slotinformation of a Tape.
Any help would be greatly appreciated.
Thank you
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
Hi, Ercan,
So, you want to move tape medium that is present in slot 2 of "Unrecognized" Media Pool to the given media pool, right? I haven't tested the following script in the environment, but, from my perspective, it should do the trick:
Thanks.
So, you want to move tape medium that is present in slot 2 of "Unrecognized" Media Pool to the given media pool, right? I haven't tested the following script in the environment, but, from my perspective, it should do the trick:
Code: Select all
$MediaPool = Get-VBRTapeMediaPool -name "Unrecognized"
$TargetMediaPool = Get-VBRTapeMediaPool -name "Name of target media pool"
$MediaPool | Get-VBRTapeMedium | where {$_.location.address -eq "2"} | Move-VBRTapeMedium -MediaPool $TargetMediaPool
-
- Novice
- Posts: 4
- Liked: never
- Joined: Sep 11, 2013 8:06 am
- Full Name: Ercan Güven
- Contact:
Re: Possible to assign tape in slot to mediapool?
Hi Vladimir,
thank you. I tried you script.
First it seems, that $_.location.address -eq must be one to access the second slot. No problem here.
But when i execute the script i get the following error:
Any suggestions?
Thank you so much
thank you. I tried you script.
First it seems, that $_.location.address -eq must be one to access the second slot. No problem here.
But when i execute the script i get the following error:
Code: Select all
Move-VBRTapeMedium : Methode nicht gefunden: "Void Veeam.Tape.Core.TapeMedium.C
lean()".
Bei C:\Users\admin\Desktop\move_mediapool.ps1:3 Zeichen:90
+ $MediaPool | Get-VBRTapeMedium | where {$_.location.address -eq "1"} | Move-V
BRTapeMedium <<<< -MediaPool $TargetMediaPool
+ CategoryInfo : NotSpecified: (:) [Move-VBRTapeMedium], MissingM
ethodException
+ FullyQualifiedErrorId : System.MissingMethodException,Veeam.Backup.Power
Shell.Command.MoveVBRTapeMedium
Thank you so much
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
I'm wondering whether you're running the said script under administrator account. Also, the missing parameter/method errors are typically related an outdated Powershell version. So, be sure to update PS to at least 3.0. In addition, sometimes reinstalling PS snap-in helps to get rid of the said issues.
Thanks.
Thanks.
-
- Novice
- Posts: 4
- Liked: never
- Joined: Sep 11, 2013 8:06 am
- Full Name: Ercan Güven
- Contact:
Re: Possible to assign tape in slot to mediapool?
Hi Vladimir,
reinstalling VEEAM Patch did the trick.
Thank you so much.
reinstalling VEEAM Patch did the trick.
Thank you so much.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
I haven't had an opportunity to test the script, so, let me know whether it works as expected. Thanks.
-
- Novice
- Posts: 4
- Liked: never
- Joined: Sep 11, 2013 8:06 am
- Full Name: Ercan Güven
- Contact:
Re: Possible to assign tape in slot to mediapool?
Hi Vladimir,
the script works as expected. I´ve made a few changes to assign all tapes from the drive to the defined mediapools after making an tape inventory.
Attached my used example.
Thank you so much!
Ercan
the script works as expected. I´ve made a few changes to assign all tapes from the drive to the defined mediapools after making an tape inventory.
Attached my used example.
Code: Select all
Start-VBRTapeInventory -Library "Name of the Tape Library"
Get-VBRTapeDrive | Eject-VBRTapeDrive
$monday = Get-VBRTapeMediaPool -name "Monday"
#Using the first to slots for Monday
$tape = Get-VBRTapeMedium | where {$_.location.address -eq "0" -or $_.location.address -eq "1"}
Move-VBRTapeMedium -Medium $tape -MediaPool $monday -Confirm:$false
Ercan
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
Glad to hear my input was helpful. Should any other help be needed, don't hesitate to let me know. Thanks.
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Aug 07, 2016 9:54 am
- Full Name: BayanINV
- Contact:
[MERGED] Move to Free from specific slot
We have set Slot# 6 as our weekly tape slot, where we add weekly tape to that slot.
It is not possible from v9 to set tapes slots to be used in weekly tape jobs. (it was possible in BackupExec).
Even the support guys wont help us in powershell scripts.
How can I run a script to move tape from slot#6 to free media pool before my weekly job starts.
And can we add scripts in Jobs, So the Job starts as scheduled?
I have modified the script from another thread (powershell-f26/possible-to-assign-tape- ... 21160.html):
I am new to the Veeam Backup.
It is not possible from v9 to set tapes slots to be used in weekly tape jobs. (it was possible in BackupExec).
Even the support guys wont help us in powershell scripts.
How can I run a script to move tape from slot#6 to free media pool before my weekly job starts.
And can we add scripts in Jobs, So the Job starts as scheduled?
I have modified the script from another thread (powershell-f26/possible-to-assign-tape- ... 21160.html):
Code: Select all
Start-VBRTapeInventory -Library "Name of the Tape Library"
Get-VBRTapeDrive | Eject-VBRTapeDrive
$monday = Get-VBRTapeMediaPool -name "Monday"
#Using the first to slots for Monday
$tape = Get-VBRTapeMedium | where {$_.location.address -eq "0" -or $_.location.address -eq "1"}
Move-VBRTapeMedium -Medium $tape -MediaPool $monday -Confirm:$false
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Possible to assign tape in slot to mediapool?
Hi and welcome to the community!
This will move tape from the "Media Pool 1" media pool Slot 6 to the "Free" media pool, please note that you should specify Slot minus 1 in a script as the numeration actually starts from zero:
Use pre/post-job script settings in order to start the script before/after the job.
Thanks.
This will move tape from the "Media Pool 1" media pool Slot 6 to the "Free" media pool, please note that you should specify Slot minus 1 in a script as the numeration actually starts from zero:
Code: Select all
$free = Get-VBRTapeMediaPool -Name "Free"
$pool = Get-VBRTapeMediaPool -Name "Media Pool 1"
$tape = Get-VBRTapeMedium -MediaPool $pool | where {$_.Location.SlotAddress -eq "5"}
Move-VBRTapeMedium -Medium $tape -MediaPool $free
Thanks.
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Aug 07, 2016 9:54 am
- Full Name: BayanINV
- Contact:
Re: Possible to assign tape in slot to mediapool?
This weekly I applied the script, and I got a warning message:
"Pre-job script terminated with exit code 255"
Also I noticed a Tape library discovery job, in running mode but status as idle?
What is this warning about?
"Pre-job script terminated with exit code 255"
Also I noticed a Tape library discovery job, in running mode but status as idle?
What is this warning about?
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
Can you test the provided script manually and see whether it generates any error? Thanks.
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Aug 07, 2016 9:54 am
- Full Name: BayanINV
- Contact:
Re: Possible to assign tape in slot to mediapool?
@v.Eremin I tried the manually, and it failed below is the errors:
Code: Select all
PS C:\> . c:\Weekly.ps1
Get-VBRTapeMediaPool : The term 'Get-VBRTapeMediaPool' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Weekly.ps1:1 char:9
+ $free = Get-VBRTapeMediaPool -Name "Free"
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRTapeMediaPool:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-VBRTapeMediaPool : The term 'Get-VBRTapeMediaPool' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Weekly.ps1:2 char:9
+ $pool = Get-VBRTapeMediaPool -Name "Weekly"
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRTapeMediaPool:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-VBRTapeMedium : The term 'Get-VBRTapeMedium' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\Weekly.ps1:3 char:9
+ $tape = Get-VBRTapeMedium -MediaPool $pool | where {$_.Location.SlotAddress -eq ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRTapeMedium:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Move-VBRTapeMedium : The term 'Move-VBRTapeMedium' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At C:\Weekly.ps1:4 char:1
+ Move-VBRTapeMedium -Medium $tape -MediaPool $free
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Move-VBRTapeMedium:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
In order to get access to VB&R specific commandlets you have to load VB&R snap-in first. Thanks.
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Aug 07, 2016 9:54 am
- Full Name: BayanINV
- Contact:
Re: Possible to assign tape in slot to mediapool?
Do I need to add that command at the start of the script?
Code: Select all
Add-PSSnapin VeeamPSSnapin
Code: Select all
Add-PSSnapin VeeamPSSnapin
$free = Get-VBRTapeMediaPool -Name "Free"
$pool = Get-VBRTapeMediaPool -Name "Weekly"
$tape = Get-VBRTapeMedium -MediaPool $pool | where {$_.Location.SlotAddress -eq "5"}
Move-VBRTapeMedium -Medium $tape -MediaPool $free
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
Correct. Thanks.Do I need to add that
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Aug 07, 2016 9:54 am
- Full Name: BayanINV
- Contact:
Re: Possible to assign tape in slot to mediapool?
This is running me mad. Got another error:
Do I have to change the file extension to .bat as I used the .ps1 extension.
Code: Select all
Error running pre-job script: The specified executable is not a valid application for this OS platform
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
You can specify the following command as a pre-job activity:
The script itself should start with "Add-PSSnapin VeeamPSSnapin".
Thanks.
Code: Select all
Powershell.exe -File C:\YourScript.ps1
Thanks.
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Aug 07, 2016 9:54 am
- Full Name: BayanINV
- Contact:
Re: Possible to assign tape in slot to mediapool?
Thanks,
My pre-job script is now Working Fine. To summarize
Created a script with extension .ps1, and added "Add-PSSnapin VeeamPSSnapin"
At the Job's Advance Setting window - under Job-scripts
enabled Run the following script before the job:
My pre-job script is now Working Fine. To summarize
Created a script with extension .ps1, and added "Add-PSSnapin VeeamPSSnapin"
Code: Select all
Add-PSSnapin VeeamPSSnapin
$free = Get-VBRTapeMediaPool -Name "Free"
$pool = Get-VBRTapeMediaPool -Name "Weekly"
$tape = Get-VBRTapeMedium -MediaPool $pool | where {$_.Location.SlotAddress -eq "5"}
Move-VBRTapeMedium -Medium $tape -MediaPool $free
enabled Run the following script before the job:
Code: Select all
Powershell.exe -File C:\Weekly.ps1
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Possible to assign tape in slot to mediapool?
I've created previously a post describing different ways to use PowerShell scripts as a pre/post-job activity; the suggest approach is mentioned there as well.
Anyway, glad to hear that everything works as expected for you.
Thanks.
Anyway, glad to hear that everything works as expected for you.
Thanks.
Who is online
Users browsing this forum: No registered users and 6 guests