Hi Luc,
can you please suggest on the orange part of the following code. This is to add static routes on each esxi host and do some operations on replication appliances .
since there are no commands for replication nor any api so iam trying to automate whaterver possible with existing commnds.
i have two questions related to orange lines.
1 .stop-vm -vm $replication_appliance -whatif
will stop-vm is a kind of graceful shutdown for vm.
2:Start-Process https://172.16.7.20:5480 -Credential $cred_vami
can we ensure if start-proces to access vami opens in mozila and assign credential as mentioned above.
code is below:
$vcenter=read-host "provide vcenter name"
$cred=get-credential
$cred_vami=Get-Credential
connect-viserver $vcenter -credential $cred|out-null
$con=$global:defaultviserver
if($con.name -eq '172.1.1.1')
{
write-host "we are working in prod vcentercer remeber to enable vspherereplication traffic on vmk2 on esach esxi" -ForegroundColor DarkMagenta
$vmhosts=get-vmhost
foreach($vmhost in $vmhosts)
{
new-vmhostroute -vmhost $vmhost -destination 172.16.9.0 -prefixlength 25 -gateway 172.16.9.1 -whatif
}
$replication_appliance = get-vm vra_pro
stop-vm -vm $replication_appliance -whatif
$portgroup_replication=get-vdportgroup -name replication_113
new-networkadapter -vm $replication_appliance -portgroup $portgroup_replication -whatif
start-vm -vm $replication_appliance -whatif
write-host "now we are going to configure vra prod appilance" -ForegroundColor Blue
Start-Process https://172.16.7.20:5480 -Credential $cred_vami
}
else
{
write-host "we are working in dr vcenter rember to configure replication nfc traffic on each esxi on vmk2" -ForegroundColor Green
$vmhosts=get-vmhost
foreach($vmhost in $vmhosts)
{
new-vmhostroute -vmhost $vmhost -destination 172.16.9.128-prefixlength 25 -gateway 172.16.9.129 -whatif
}
$replication_appliance = get-vm vra_dr
stop-vm -vm $replication_appliance -whatif
$portgroup_replication=get-vdportgroup -name replication_113
new-networkadapter -vm $replication_appliance -portgroup $portgroup_replication -whatif
start-vm -vm $replication_appliance -whatif
write-host "now we are going to configure vra_dr appilance" -ForegroundColor Blue
Start-Process https://172.16.7.150:5480 -Credential $cred_vami
}
1. No Stop-VM is a hard power off.
For a graceful shutdown of the guest OS, you use Stop-VMGuest
2. It depends what application you have defined as the default for webpages.
The Credential parameter on Start-Process is intended for use with -Verb runas, not to logon to a webpage.
I'm not sure why you are trying to go this way, with esxcli you can add static routes ($esxcli.network.ip.route.ipv4.add)
See also KB2001426
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
1. No Stop-VM is a hard power off.
For a graceful shutdown of the guest OS, you use Stop-VMGuest
2. It depends what application you have defined as the default for webpages.
The Credential parameter on Start-Process is intended for use with -Verb runas, not to logon to a webpage.
I'm not sure why you are trying to go this way, with esxcli you can add static routes ($esxcli.network.ip.route.ipv4.add)
See also KB2001426
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
1:thnaks iam going to use stop-vmguest.
2:well i am trying to open vamiof appliance is there any powershell /powercli way to start page and login .
i think using essxcli or add-vmhost both are going to acheive the same result .or is there any diference.
Not sure what you are doing with Add-VMHost here?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
sorry i meant new-vmhostroute
Ok, got it.
Now why do you want to logon to the Appliance in this way?
There is an API to interact with the vRA appliance.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thnaks.well my intension to put most of the things possible in script.
Which is exactly the purpose of an API.
What do you want to do in the appliance?
Did you check if it possible through the vRA API?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
by vRA i mean replication apliance.and i wanted to do some configurtion change inside vami .
adding ip address for incoming storage traffic.
You lost me there.
You are talking about vRealize Automation then?
Perhaps a screenshot would clarify what you are trying to do? Which setting?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
well i am talking about vsphere replication apliance .i know there are no powercli commands to do anything related for vsphere replication .
not sure why it has been left alone .
however i though of adding extra ipbelow .is there any api way??
Got it, but I'm afraid there is no public API that appliance.
Not too sure how you would interact with that form over a remote connection.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thnaks i will do that task manualy however i found something replication plugin for vro .if there is no api how can we have plugin or default workflows for replication.
Sorry, don't know vRO that well.
Try asking in that community.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference