troubleshooting Question

ESXi and PowerCLI

Avatar of jmachado81
jmachado81 asked on
Powershell* vsan* PowerCLIVMware
6 Comments2 Solutions96 ViewsLast Modified:
I have created a 2 node vsan cluster with a witness.  The two physical hosts are interconnected with 10gb links and the vsan vmkernel resides on that particular vswitch.  I leave the mgmt on the default vSwitch0 which uses vmk0.

I'm looking for a way to script in powercli/powershell adding a route to the esxi hosts so that it can communicate with the witness.

$HostNameFQDN =

This outputs nothing on my system currently but it seems like i'm really close.
$Host_Gateway = Get-VMHost -Name $HostNameFQDN | Get-VMHostNetworkAdapter | select VMKernelGatway

New-VMHostRoute -VMHost $HostNameFQDN -Destination -Gateway $Host_Gateway -PrefixLength 20

Would somebody be able to assist with getting this to work, correctly?  I've also noticed that the Get-network commands do not work in Powershell ISE but they do in the regular powershell window.

Thanks in advance.
Solutions Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros