-
- Lurker
- Posts: 2
- Liked: 1 time
- Joined: Jan 27, 2014 4:02 pm
- Full Name: Lee Warren
- Contact:
Tape Media Pool Report PS script no longer works in V8
To the PowerShell guru's. Would anybody be able to fix this script so that it will run under the V8 B&R. We had this working great in V7 s0 we could get a list of our tapes and what Media Pools they were in. I have searched over the community and the documentation on powershell but I'm just not that good with PS to come up with the answer.
Get-VBRTapeMedium |
where {$_.FindMediaPool().name -ne ""}
Select-Object -Property @{N="Name";E={$_.Name}}, @{N="Barcode";E={$_.Barcode}},@{N="Media Pool";E={$_.FindMediaPool().name}},@{N="Retention";E={$_.FindMediaPool().Options.OverwritePeriod.value}}, @{N="Last write";E={$_.LastWriteTime}}, @{N="Overwrite date";E={$_.lastwritetime + $_.FindMediaPool().Options.OverwritePeriod.ToTimeSpan()}} |
Convertto-HTML -head $a -body $header |
Out-file C:\reports\VeeamTapeReport\VeeamMediaPool.html
Thanks,
Lee Warren
Get-VBRTapeMedium |
where {$_.FindMediaPool().name -ne ""}
Select-Object -Property @{N="Name";E={$_.Name}}, @{N="Barcode";E={$_.Barcode}},@{N="Media Pool";E={$_.FindMediaPool().name}},@{N="Retention";E={$_.FindMediaPool().Options.OverwritePeriod.value}}, @{N="Last write";E={$_.LastWriteTime}}, @{N="Overwrite date";E={$_.lastwritetime + $_.FindMediaPool().Options.OverwritePeriod.ToTimeSpan()}} |
Convertto-HTML -head $a -body $header |
Out-file C:\reports\VeeamTapeReport\VeeamMediaPool.html
Thanks,
Lee Warren
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Tape Media Pool Report PS script no longer works in V8
Hi, Lee,
Try the following example and see whether it meets your expectations:
Thanks.
Try the following example and see whether it meets your expectations:
Code: Select all
asnp VeeamPSSnapin
Get-VBRTapeMedium | Select-Object -Property @{N="Name";E={$_.Name}}, @{N="Barcode";E={$_.Barcode}},@{N="Media Pool";E={(Get-VBRTapeMediaPool -Id $Medium.MediaPoolId).name}},@{N="Expiration Date";E={$_.expirationDate}}, @{N="Last write time";E={$_.LastWriteTime}}
-
- Novice
- Posts: 8
- Liked: 2 times
- Joined: Feb 13, 2015 9:00 pm
- Contact:
Re: Tape Media Pool Report PS script no longer works in V8
Hi PS Guru's,
I need help on this script as it used to work prior to v8.
$senderAddress = "fake@fake.com"
$recipients1 = "test@test.com"
$recipients2 = "test1@test1.com"
$jobName = "Backup Tape"
$EXserverIP = "tape.backup.com"
$secpasswd = ConvertTo-SecureString "1234567" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("fake@fake.com", $secpasswd)
$job = get-vbrtapejob | ? {$_.name -eq $jobName}
$result1 = $job.GetLastState()
$result2 = $job.GetLastResult()
if ($result1 -ne "Stopped" -or $result2 -ne "Success")
{
$strMessage = "The Veeam job ", $job.Name, " is still running or completed with error. Please check the status of the Replication job."
send-mailmessage -to $recipients1,$recipients2 -from $senderAddress -subject "$strMessage" -body "$strMessage" -smtpserver $EXserverIP -credential $mycreds -priority High -dno onSuccess, onFailure
}
else
{
$strMessage = "The Veeam job ", $job.Name, " was successful."
send-mailmessage -to $recipients1,$recipients2 -from $senderAddress -subject "$strMessage" -body "$strMessage" -smtpserver $EXserverIP -credential $mycreds -dno onSuccess, onFailure
}
start-sleep 5
I need help on this script as it used to work prior to v8.
$senderAddress = "fake@fake.com"
$recipients1 = "test@test.com"
$recipients2 = "test1@test1.com"
$jobName = "Backup Tape"
$EXserverIP = "tape.backup.com"
$secpasswd = ConvertTo-SecureString "1234567" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("fake@fake.com", $secpasswd)
$job = get-vbrtapejob | ? {$_.name -eq $jobName}
$result1 = $job.GetLastState()
$result2 = $job.GetLastResult()
if ($result1 -ne "Stopped" -or $result2 -ne "Success")
{
$strMessage = "The Veeam job ", $job.Name, " is still running or completed with error. Please check the status of the Replication job."
send-mailmessage -to $recipients1,$recipients2 -from $senderAddress -subject "$strMessage" -body "$strMessage" -smtpserver $EXserverIP -credential $mycreds -priority High -dno onSuccess, onFailure
}
else
{
$strMessage = "The Veeam job ", $job.Name, " was successful."
send-mailmessage -to $recipients1,$recipients2 -from $senderAddress -subject "$strMessage" -body "$strMessage" -smtpserver $EXserverIP -credential $mycreds -dno onSuccess, onFailure
}
start-sleep 5
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Tape Media Pool Report PS script no longer works in V8
LastState and LastResult are now static properties, not dynamic methods. Based on that, you can implement the corresponding changes:
Thanks.
Code: Select all
$result1 = $job.LastState
$result2 = $job.GetLastResult
-
- Novice
- Posts: 8
- Liked: 2 times
- Joined: Feb 13, 2015 9:00 pm
- Contact:
Re: Tape Media Pool Report PS script no longer works in V8
great it works, thanks!
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Tape Media Pool Report PS script no longer works in V8
Just be aware that now those properties are static in their nature. Meaning, if previously you could have something like this, and everything worked as expected:
Now, you'll have to change the script slightly, so that, last state property gets updated inside a cycle:
Thanks.
Code: Select all
$TapeJob = Get-VBRTapeJob -name "Name of your tape job"
do
{...}while ($TapeJob.GetLastState() -ne "Stopped")
Code: Select all
do
{
$TapeJob = Get-VBRTapeJob -name "Name of your tape job"
....
}while ($TapeJob.LastState -ne "Stopped")
Who is online
Users browsing this forum: No registered users and 5 guests