cancel
Showing results for 
Search instead for 
Did you mean: 

Unlocking library via command line (BE2012)

norbertg
Level 5

I found a solution to unlock the library via powershell (http://www.symantec.com/connect/forums/scheduling-unlock-job-be2012). When I try to run the command I receive the following error:

PS C:\Users\sysadmin> c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
Submit-BEUnlockJob -RoboticLibraryDevice '"Robotic library 00009"'
The term 'Submit-BEUnlockJob' is not recognized as the name of a cmdlet, functi
on, script file, or operable program. Check the spelling of the name, or if a p
ath was included, verify that the path is correct and try again.
At line:1 char:19
+ Submit-BEUnlockJob <<<<  -RoboticLibraryDevice Robotic library 00009
    + CategoryInfo          : ObjectNotFound: (Submit-BEUnlockJob:String) [],
   CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\sysadmin>


I tried changing Submit-BEUnlockJob to -Submit-BEUnlockJob but I still get errors;

PS C:\Users\sysadmin> c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
-Submit-BEUnlockJob -RoboticLibraryDevice '"Robotic library 00009"'
Missing expression after unary operator '-'.
At line:1 char:2
+ - <<<< Submit-BEUnlockJob -RoboticLibraryDevice Robotic library 00009
    + CategoryInfo          : ParserError: (-:String) [], ParentContainsErrorR
   ecordException
    + FullyQualifiedErrorId : MissingExpressionAfterOperator

PS C:\Users\sysadmin>


I don't know much about powershell or how to fix the error, any help would be appricated.

Also which part of the backup job do I add the unlock script to?

1 ACCEPTED SOLUTION

Accepted Solutions

pkh
Moderator
Moderator
   VIP    Certified

You can either put the import-module and the submit-beunlockjob cmdlets in a script and schedule the script, or do it in-line.  See this document for some examples.

http://www.symantec.com/docs/TECH189795

View solution in original post

9 REPLIES 9

pkh
Moderator
Moderator
   VIP    Certified

You need to import the BEMCLI module before you can use any BEMCLI cmdlet.  See my article below on how to do the import.

https://www-secure.symantec.com/connect/articles/preparing-your-powershell-environment-run-bemcli-and-scripts

norbertg
Level 5

Any other way to unlock the library via a scheduled task?

norbertg
Level 5

I've followed your guide and it's still not working.

With get-executionpolicy -list I receive the following:

          Scope                         ExecutionPolicy
          -----                         ---------------
  MachinePolicy                               Undefined
     UserPolicy                               Undefined
        Process                               Undefined
    CurrentUser                               Undefined
   LocalMachine                            RemoteSigned

 

I've run import-module "\program files\symantec\backup exec\modules\bemcli\bemcli" via BE Management Console.

PS error:

PS C:\Users\sysadmin> c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
Submit-BEUnlockJob -RoboticLibraryDevice '"Robotic library 00009"'
The term 'Submit-BEUnlockJob' is not recognized as the name of a cmdlet, functi
on, script file, or operable program. Check the spelling of the name, or if a p
ath was included, verify that the path is correct and try again.
At line:1 char:19
+ Submit-BEUnlockJob <<<<  -RoboticLibraryDevice Robotic library 00009
    + CategoryInfo          : ObjectNotFound: (Submit-BEUnlockJob:String) [],
   CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\sysadmin>

pkh
Moderator
Moderator
   VIP    Certified

You can either put the import-module and the submit-beunlockjob cmdlets in a script and schedule the script, or do it in-line.  See this document for some examples.

http://www.symantec.com/docs/TECH189795

pkh
Moderator
Moderator
   VIP    Certified

The import-module cmdlet must be run for each powershell session or script.  It is not a one-time thing.  You must import the module for every run.  If you want to automate the import-module, put it in the profile.  See my article which I have referenced above.

norbertg
Level 5

I am getting closer.

In unlocklib.ps1 I have:

import-module bemcli
Submit-BEUnlockJob -RoboticLibraryDevice '"Robotic library 00001"'

I have tried changing "Robotic library 00009"' to "Robotic library 00001"'. but I get the following error:

PS C:\scripts\BackupExec> C:\scripts\BackupExec\unlocklib.ps1
Submit-BEUnlockJob : Cannot bind parameter 'RoboticLibraryDevice'. Cannot convert value ""Robotic library 00001"" to type "BackupExec.Ma
nagement.CLI.BERoboticLibraryDevice". Error: "Cannot find any RoboticLibraryDevice objects with the name "Robotic library 00001"."
At C:\scripts\BackupExec\unlocklib.ps1:2 char:41
+ Submit-BEUnlockJob -RoboticLibraryDevice <<<<  '"Robotic library 00001"'
    + CategoryInfo          : InvalidArgument: (:) [Submit-BEUnlockJob], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,BackupExec.Management.CLI.Commands.SubmitBEUnlockJobCommand

I am not sure how to work out which library to use, could you point me in the right direction?

We dont' have anyone to manage BE full time, thanks for your help thus far.

Edit found the command in the original post of mine to run: Get-BERoboticLibraryDevice. I am waiting for the process to finish.

norbertg
Level 5

Here is the result from Get-BERobo...

PS D:\Program Files\Symantec\Backup Exec> Get-BERoboticLibraryDevice

Name            StorageType          Active   Paused   Disabled Servers
----            -----------          ------   ------   -------- -------
IBM 2           RoboticLibraryDevice False    False    False    {VSDOM01}


PS D:\Program Files\Symantec\Backup Exec>

pkh
Moderator
Moderator
   VIP    Certified

You need to use this

Get-BERoboticLibraryDevice "IBM 2" | Submit-BEUnlockJob -confirm:$false

norbertg
Level 5

Thank you :)