cancel
Showing results for 
Search instead for 
Did you mean: 

Cloning BE 2012 Job on many server

winkler-edv
Level 3

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

1 ACCEPTED SOLUTION

Accepted Solutions

pkh
Moderator
Moderator
   VIP    Certified

I believe you need to do this

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

View solution in original post

4 REPLIES 4

pkh
Moderator
Moderator
   VIP    Certified

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

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

winkler-edv
Level 3

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
Moderator
Moderator
   VIP    Certified

I believe you need to do this

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

winkler-edv
Level 3

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?