03-04-2013 07:34 AM
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
Solved! Go to Solution.
03-04-2013 11:56 PM
I believe you need to do this
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "c:\script\master.ps1 -AgentServer srv-clone1 | Save-BEBackupDefinition"
03-04-2013 04:51 PM
In your script, you need to import the BEMCLI module with
import-module "\program files\symantec\backup exec\modules\bemcli\bemcli"
03-04-2013 11:29 PM
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
03-04-2013 11:56 PM
I believe you need to do this
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "c:\script\master.ps1 -AgentServer srv-clone1 | Save-BEBackupDefinition"
03-05-2013 12:16 AM
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?