Firestreamer Automation: Sample Script

The technical support forum for Firestreamer (the virtual tape library).
jsf
Cristalink Support
Posts: 300
Joined: 29 Aug 2010, 09:03

Post by jsf »

The attached sample script is designed to handle the following scenario:
  • You use several external disk drives in file media mode, one external disk at a time.
  • Each external disk has its own set of virtual tapes and a corresponding media map file named FirestreamerMediaMap.fsmap in the root folder on the disk.
  • Once you connect an external disk, in 30 seconds, the scripts loads FirestreamerMediaMap.fsmap from the disk by unlocking the library door in Microsoft DPM, applying the new media layout in Firestreamer, and locking the library door.
  • When you disconnect a disk, in 30 seconds, the script unloads all tapes.
  • It does not matter whether it takes less or more than 30 seconds for you to swap the disks.
  • If there are more than two disks with FirestreamerMediaMap.fsmap connected at the same time, the first available media map file is loaded.

To use the script:
  1. Extract files from the appropriate subfolder of attached FsMonitor.zip into C:\Scripts\.
  2. Open Windows Task Scheduler and create a new scheduled task with the following parameters:
    • On the General tab, in Name, enter FsMonitor; in When running the task, use the following user account, enter the name of an account that has access to Microsoft DPM, Firestreamer, and disks; select Run whether user is logged on or not; unselect Do not store password; select Run with highest privileges; in Configure for, select Windows 7, Windows Server 2008 R2.
    • On the Triggers tab, create a new trigger. In Begin the task, select At startup.
    • On the Actions tab, create a new action. In Action, select Start a program; in Program/script, enter C:\Scripts\FsMonitor.cmd.
    • On the Settings tab, unselect Stop the task if it runs longer than.
  3. Restart the computer, or start the task manually.

Of course, you can modify the script to handle practically any scenario.
Attachments
FsMonitor-20121116.zip
(8.55 KiB) Downloaded 2624 times
techbiker
Posts: 6
Joined: 30 Aug 2012, 04:42

Post by techbiker »

Hi John,

Thanks for posting this script! It will hopefully help me solve this painful issue. I am confused however as to how I should generate the FirestreamerMediaMap.fsmap file. Also, once I generate this file, do I just copy it to each removable drive that will be used in the removable drive bay?

How should I assign virtual tapes to each drive as well?

Thanks!

techbiker
jsf
Cristalink Support
Posts: 300
Joined: 29 Aug 2010, 09:03

Post by jsf »

how I should generate the FirestreamerMediaMap.fsmap file
Use the Save As command in the Media Layout Editor. You can also edit the file with any text editor.
do I just copy it to each removable drive that will be used in the removable drive bay
Yes. Note that the file will be different for each drive because each drive must contain a unique set of tapes (in other words, there must be no tapes with duplicate barcodes, which means there must be no two .fsrm files with the same name).
How should I assign virtual tapes to each drive
Use the Media Layout Editor to create new tapes for each drive.

See also Firestreamer FAQs.
Best regards,
John Smith
Cristalink Support
bobsg
Posts: 2
Joined: 24 Oct 2012, 22:28

Post by bobsg »

Hi,

Im trying to run the script but am getting the following error:

Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.DataProtectionManager.PowerShell' is n
hine.
At C:\Scripts\FsMonitor.ps1:196 char:17
+ Add-PSSnapin <<<< -Name $DPMSnapIn
+ CategoryInfo : InvalidArgument: (Microsoft.DataP...ager.PowerShell:String) [Add-
ception
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Im running DPM 2012, which has been working fine until a few days ago. I was running a similar put-together script, but thought i would change it over to this one.

Is there anything special i have to do to get this add-in?

Thanks
jsf
Cristalink Support
Posts: 300
Joined: 29 Aug 2010, 09:03

Post by jsf »

For DPM 2012, try one of the following (borrowed from here):

Add-PSSnapin -name Microsoft.DataProtectionManager.2012.Powershell

or

Import-Module DataProtectionManager
Best regards,
John Smith
Cristalink Support
bobsg
Posts: 2
Joined: 24 Oct 2012, 22:28

Post by bobsg »

Hi,

Thanks for the reply, however im still having issues.

When i tried adding the 2012, it still had the same error. When I tried the import line instead, the script starts and gets this far:

DPM Server: #########

Firestreamer interface version: 4.0.0
Firestreamer driver version : 4.0.1

Library: Firestreamer Media Changer (L0CHGR9062C838D7CFE111BF81F4CE4)
Firestreamer library number: 1

But then just hangs, and firestreamer doesnt pick up the new fsmap.

Help?
jsf
Cristalink Support
Posts: 300
Joined: 29 Aug 2010, 09:03

Post by jsf »

But then just hangs, and firestreamer doesnt pick up the new fsmap.
It was because Microsoft changed the behavior of Unlock-DPMLibraryDoor which now asks for a confirmation by default. We updated the script accordingly.
Best regards,
John Smith
Cristalink Support
techbiker
Posts: 6
Joined: 30 Aug 2012, 04:42

Post by techbiker »

Howdy John,

I spent a couple of hours getting the script to work today. At first, the server refused to run the script because it was not signed. I had to self-sign it with a security key. Even after signing the script and getting it to run successfully though, I ran into another error. The fsmap file and virtual tapes are still not loaded within 30 seconds. Under the fsmonitor text error file in the c:/scripts folder, the following error is now listed:

AuthorizationManager check failed.
At line:1 char:2
+ . <<<< 'C:\Scripts\FsMonitor.ps1'
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException

What do you think the problem might be?

Thanks
jsf
Cristalink Support
Posts: 300
Joined: 29 Aug 2010, 09:03

Post by jsf »

The script does not require to be signed on Windows Server 2008 R2 and 2012 with default security settings.

Are you able to fully access Firestreamer and Microsoft DPM from the account under which the script runs?

Right-click the script, and then select Properties to see if you can "unblock" the script.

Make sure the script is run with elevated security privileges.

Check the log file created by the script in C:\Scripts to see if there is any useful information there. Try to execute individual commands from the script from a PowerShell prompt to see which command fails.

If it does not help, there must be something with your security settings.
AuthorizationManager check failed.
At line:1 char:2
+ . <<<< 'C:\Scripts\FsMonitor.ps1'
It looks like something blocks the entire script on your server. Try to run any simple PowerShell script, like Write-Host "Hello world".

I am afraid we cannot be more helpful.
Best regards,
John Smith
Cristalink Support
techbiker
Posts: 6
Joined: 30 Aug 2012, 04:42

Post by techbiker »

Hi John,

My apologies for the slow reply but I've been very busy recently. It turns out the problem was with the security settings.I had been running the script with an account that had administrative privileges, not the administrator account. Now, the script seems to be working properly in that it loads the proper media file once a drive is connected.

I reconfigured DPM to hopefully the correct settings but it is still not working!! I'm at wits end with this 6 month long ordeal and would like to get things resolved (it is essential for this business). We will be forced to drop DPM and Firestreamer if a solution cannot be found.

John, would you be available for phone support and/or remote login sometime tomorrow?

Thanks again

Dallas
Locked