This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
tsm:tdpve_scripts1 [2021/03/05 17:54] manu |
tsm:tdpve_scripts1 [2022/01/27 17:17] (current) manu |
||
---|---|---|---|
Line 8: | Line 8: | ||
START /B dsmc backup vm "SRVLNX2" -vmbackuptype=fullvm -mode=ifincremental -asnodename=DC1 -optfile="C:\Program Files\Tivoli\TSM\baclient\dsm.DC1_DM.opt" >> "C:\Program Files\Tivoli\TSM\baclient\dsmsched.DC1_DM.incr1.log" | START /B dsmc backup vm "SRVLNX2" -vmbackuptype=fullvm -mode=ifincremental -asnodename=DC1 -optfile="C:\Program Files\Tivoli\TSM\baclient\dsm.DC1_DM.opt" >> "C:\Program Files\Tivoli\TSM\baclient\dsmsched.DC1_DM.incr1.log" | ||
</cli> | </cli> | ||
+ | |||
+ | ===== Script backup VM ===== | ||
+ | |||
+ | This script is planned to use with a linux datamover and powershell installed | ||
+ | <cli prompt='#'> | ||
+ | [root@tdpvelnx]/usr/scripts # cat Backup-VM.ps1 | ||
+ | </cli> | ||
+ | <code> | ||
+ | #!/usr/bin/pwsh | ||
+ | |||
+ | <# | ||
+ | .SYNOPSIS | ||
+ | Backup ALL VM | ||
+ | .OUTPUTS | ||
+ | @{ExitCode=;StdOut=,StdErr=} | ||
+ | #> | ||
+ | |||
+ | # Global Parameters | ||
+ | $VMvCenterName = 'vcenter01' | ||
+ | $VMvCenterUser = 'tdpve@vsphere.local' | ||
+ | $VMvCenterPass = 'xxxxxxxxxx' | ||
+ | |||
+ | # TSM Parameters | ||
+ | $Exclude_VM = @("vmtest4","vcenter01") | ||
+ | $AsNode = 'DATACENTER' | ||
+ | $VMprod = @("vmtest1:vmdk=Hard Disk 1","vmtest2:vmdk=Hard Disk 1:vmdk=Hard Disk 2") | ||
+ | |||
+ | |||
+ | Write-Verbose "vCenter Name . . = $VMvCenterName" | ||
+ | |||
+ | |||
+ | # | ||
+ | # Connect to vCenter | ||
+ | # | ||
+ | Write-Host "Connecting to vcenter $($VMvCenterName)..." | ||
+ | try { | ||
+ | Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -WarningAction SilentlyContinue -ParticipateInCeip $false -DisplayDeprecationWarnings $false -confirm:$false | ||
+ | $VCSession = Connect-VIServer -Server $VMvCenterName -User $VMvCenterUser -Password $VMvCenterPass | ||
+ | } | ||
+ | catch { | ||
+ | write-host "Error to connect to vCenter $VMvCenterName." | ||
+ | exit -1 | ||
+ | } | ||
+ | |||
+ | ### | ||
+ | ### Retreive VM Information | ||
+ | ### | ||
+ | Write-Host "Retreive VM information..." | ||
+ | $env:LD_LIBRARY_PATH = "/opt/tivoli/tsm/client/ba/bin:/opt/tivoli/tsm/tdpvmware/common/jre/jre/bin/classic" | ||
+ | |||
+ | Write-Host "##### Backup VM Starting" | ||
+ | Foreach( $VM in $( Get-VM | Select-String -pattern $Exclude_VM -notMatch)) { | ||
+ | Write-Host "#### Backup VM: $VM" | ||
+ | /usr/bin/dsmc ba vm $VM -optfile="/opt/tivoli/tsm/client/ba/bin/dsm_ve.opt" -asnode="$AsNode" | ||
+ | } | ||
+ | Write-Host "##### Backup VM Finished" | ||
+ | |||
+ | Write-Host "##### Backup specific VM Starting" | ||
+ | Foreach( $VM in $VMprod) { | ||
+ | Write-Host "#### Backup VM: $VM" | ||
+ | Write-Host /usr/bin/dsmc ba vm $VM -optfile="/opt/tivoli/tsm/client/ba/bin/dsm_ve.opt" -asnode="$AsNode" | ||
+ | /usr/bin/dsmc ba vm $VM -optfile="/opt/tivoli/tsm/client/ba/bin/dsm_ve.opt" -asnode="$AsNode" | ||
+ | } | ||
+ | Write-Host "##### Backup specific VM Finished" | ||
+ | |||
+ | |||
+ | ### | ||
+ | ### Disconnect from vCenter | ||
+ | ### | ||
+ | |||
+ | Disconnect-VIServer -Server $VMvCenterName -Confirm:$false | ||
+ | |||
+ | exit $RC | ||
+ | |||
+ | </code> | ||
===== Get disks backupped ===== | ===== Get disks backupped ===== |