Video Screencast Help
Give us your opinion and win with Symantec! Please help us by taking this survey to tell us about your experience with Symantec Connect, so that we can continue to grow and improve.  Take the survey.

Cloning BE 2012 Job on many server

Created: 04 Mar 2013 • Updated: 05 Mar 2013 | 4 comments
This issue has been solved. See solution.

Hello all!

I'm trying to clone some BE-Servers using BEMCLI.
Export the definition works fine:
export-master.cmd contains:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\script\export-master.ps1

export-master.ps1 contains:

Get-BEBackupDefinition "wi-master-Backup" | Export-BEBackupDefinition > c:\script\master.ps1

convert-script.exe contains:

change some settings in master.ps1 using substitution

Now, i would like to import via import-cmd:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe c:\script\master.ps1 -AgentServer srv-clone1 | Save-BEBackupDefinition

But this doesn't work. "Can't find Save-BEBackupDefinition"
When i open BEMCLI in a cmd-windows i can use

c:\script\master.ps1 -AgentServer srv-clone1 | Save-BEBackupDefinition

And it works. How can i script this in one cmd-file?

Best regards

Peter

Operating Systems:

Comments 4 CommentsJump to latest comment

pkh's picture

In your script, you need to import the BEMCLI module with

import-module "\program files\symantec\backup exec\modules\bemcli\bemcli"

winkler-edv's picture

Hello pkh

Thanks for your advice! i'm not sure, if i understood.

I already imported the bemcli in powershell. The export-master.cmd works fine and start export-master.ps1 and this runs

Get-BEBackupDefinition "wi-master-Backup" | Export-BEBackupDefinition > c:\script\master.ps1

successfully.

I guess its a matter of masking? the part "| Save-BEBackupDefinition" is interpreted by cmd.exe and not by powershell.exe. How can i change this behaviour?

Best regards in advance

Peter

pkh's picture

I believe you need to do this

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "c:\script\master.ps1 -AgentServer srv-clone1 | Save-BEBackupDefinition"

SOLUTION
winkler-edv's picture

Cool! THX a lot! It works fine!

I will post some other questions about scripting, it would be great, if you could hav  a look again?