-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-powerprotect.ps1
87 lines (70 loc) · 2.87 KB
/
deploy-powerprotect.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Import-Module '.\modules\dellemc.ppdm.deployment.psm1'
$cfg = Import-PowerShellDataFile -Path '.\config\config.psd1'
#TIMER
$StopWatch = New-Object -TypeName System.Diagnostics.Stopwatch
$StopWatch.start()
#VMWARE
$vSpherePwd = (Get-Content '.\passwords\_VCENTER.txt') | ConvertTo-SecureString
$vSphereCredObject = New-Object System.Management.Automation.PSCredential -ArgumentList $cfg.vmware.account, $vSpherePwd
#POWERPROTECT
$vAppCredObject = New-Object System.Management.Automation.PSCredential `
-ArgumentList $cfg.powerprotect.account, ($cfg.powerprotect.oldpwd | ConvertTo-SecureString -AsPlainText -Force)
<# NEW PPDM ADMIN PASSWORD FOR TROUBLESHOOTING
$vappPwd = (Get-Content '..\passwords\_POWERPROTECT.txt') | ConvertTo-SecureString
$vAppCredObject = New-Object System.Management.Automation.PSCredential `
-ArgumentList $cfg.powerprotect.account, $vappPwd
#>
#DATADOMAIN
$ddvePwd = (Get-Content '.\passwords\_DDVE.txt') | ConvertTo-SecureString
$ddveCredObject = New-Object System.Management.Automation.PSCredential -ArgumentList $cfg.datadomain.account, $ddvePwd
$ErrorActionPreference ='stop'
#CONNECT TO VCENTER SERVER
try
{
Write-Host "[CONNECTING] to: $($cfg.vmware.vcenter)"
$Con = Connect-VIServer -Protocol https -Server $cfg.vmware.vcenter -Credential $vSphereCredObject
}
catch {
Write-Host "Unable to connect to: $($cfg.vmware.vcenter)" -ForegroundColor Red
exit;
}
deploy-ppdm `
-vAppConnection $Con `
-vAppHost $cfg.powerprotect.esxi `
-vAppDataStore $cfg.powerprotect.datastore `
-vAppFolder $cfg.powerprotect.folder `
-vAppNetwork $cfg.powerprotect.vswitch `
-vAppName $cfg.powerprotect.name `
-vAppDomain $cfg.powerprotect.domain `
-vAppIp $cfg.powerprotect.ip `
-vAppSubnet $cfg.powerprotect.netmask `
-vAppGateway $cfg.powerprotect.gateway `
-vAppDns $cfg.powerprotect.dns `
-vAppDiskType $cfg.powerprotect.vdisktype `
-vAppOvaPath $cfg.powerprotect.ova `
-vAppAccount $cfg.powerprotect.account `
-vAppDefaultPwd $cfg.powerprotect.oldpwd `
-vAppApi $cfg.powerprotect.api
$auth = connect-ppdmrestapi `
-Server "$($cfg.powerprotect.name).$($cfg.powerprotect.domain)" `
-Credential $vAppCredObject
set-ppdminitialconfig `
-AuthObject $auth `
-vAppNTP $cfg.powerprotect.ntp `
-vAppTimezone $cfg.powerprotect.timezone
add-datadomain `
-AuthObject $auth `
-Credential $ddveCredObject `
-DD "$($cfg.datadomain.name).$($cfg.datadomain.domain)" `
add-vcenter `
-AuthObject $auth `
-Credential $vSphereCredObject `
-VCenter $cfg.vmware.vcenter
set-ppdmwhitelisting `
-AuthObject $auth
disconnect-ppdmrestapi `
-AuthObject $auth
$StopWatch.Stop()
Write-Host
Write-Host "[DEPLOYMENT TIME]: h:$($StopWatch.Elapsed.Hours) m:$($StopWatch.Elapsed.Minutes) s:$($StopWatch.Elapsed.Seconds)" -ForegroundColor Green
Write-Host