Hi,
i need a scripts to do things described in the title...i want to add a physical NIC to an existing vSwitch without replacing
the existing/configured NIC in the vSwitch...
My actual script looks like this:
$vs =Get-VirtualSwitch -VMHost $vmHost -Name vSwitch0
$vs | Set-VirtualSwitch -Nic vmnic1
This one replaces the existing NIC 😞
Any idea?
Thx in advance!
Chakoe
Hi Chakoe,
You can add a nic to a switch with:
$vs =Get-VirtualSwitch -VMHost $vmHost -Name vSwitch0 $nic = $vs.Nic + "vmnic1" $vs | Set-VirtualSwitch -Nic $nic
Regards, Robert
Although there are some problem when you use Set-VirtualSwitch in a pipeline, you can still make this a one-liner (with a bit of trickery).
Get-VirtualSwitch -Name vSwitch0 -VMHost $vmHost | %{Set-VirtualSwitch -VirtualSwitch $_ -Nic (&{$_.Nic + "vmnic1"})}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
my script now works fine so far...but i found another question...we operate our ESX - vSwitches in an Active / Passive config..
How do I have to modify my script to set the vmnic0 & vmnic2 to active and vmnic1 & vmnic3 to passive?
This is my actual script:
Connect-VIServer "virtualcenter"
$vmHost = Get-VMHost Host1 | Sort-Object {$_.Name}
# Add another COS-NIC
Get-VirtualSwitch -Name vSwitch0 -VMHost $vmHost | %{Set-VirtualSwitch -VirtualSwitch $_ -Nic (&{$_.Nic + "vmnic1"})}
# Add first NIC to VM-Network-VSwitch
Get-VirtualSwitch -Name vSwitch1 -VMHost $vmHost | Set-VirtualSwitch -Nic "vmnic2"
# Add second NIC to VM-Network-VSwitch
Get-VirtualSwitch -Name vSwitch1 -VMHost $vmHost | %{Set-VirtualSwitch -VirtualSwitch $_ -Nic (&{$_.Nic + "vmnic3"})}
Thx in advance
Chakoe
You can use the Set-NicTeamingPolicy cmdlet for that.
Get-VirtualSwitch -Name vSwitch0 -VMHost $vmHost | Get-NicTeamingPolicy | Set-NicTeaminPolicy -MakeNicActive "vmnic0","vmnic2" -MakeNicStandby "vmnic1","vmnic3"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
my script works fine right now!
THANKS!
But:
Does anyone if you can use PowerCLI to stage an Remediate the Host as you can do it in VSphereClient ( Host Update Manager)?
Yes you can. Use the Update Manager snapin.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
I tried to download
Error is: Invalid Download Group
I can´t install this version, error is ( simplified): PowerCLI 4.0 or earlier needed...
I´ve installed PowerCLI 4.1.1 on my machine........
Where can i find the download for Snapin 4.1?
I get the same error, must be something wrong with the link to the repository.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You will need version 4.1. But there seems to be something wrong on the VMware download server now. It has worked well before.
VMW is looking into it.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Good morning,
not fixed so far... 😞
wait wait 🙂
If you send me a private mail with your e-mail address, I will put the VMware vCenter Update Manager PowerCLI 4.1 installation kit in my DropBox for you (See: www.dropbox.com).
Hi,
same error message:
Incombatible Versio ov Power CLI, PowerCLI 4.0 or later is needed....
But it is installed....install Package was VMware-PowerCLI-4.1.1-332441.exe
What´s going wrong here?
What output do you get from the Get-PowerCLIVersion cmdlet? You should get:
PowerCLI Version
----------------
VMware vSphere PowerCLI 4.1 U1 build 332441
---------------
Snapin Versions
---------------
VMWare vSphere PowerCLI 4.1 U1 build 332441
VMware vCenter Update Manager PowerCLI 4.1 build 266648
Hi,
output is:
PowerCLI Version
----------------
VMware vSphere PowerCLI 4.1 U1 build 332441
---------------
Snapin Versions
---------------
VMWare vSphere PowerCLI 4.1 U1 build 332441
So your PowerCLI version is the latest. If I install the VMware Update Manager PowerCLI package from the DropBox (VMware-UpdateManager-Pscli-4.1.0-266648.exe) again and do a repair I have no problems
Hi Robert,
i just rebootet my Notebook ( W XP SP3 )...same problem.
Is there another Chance? Can i get the extracted MSI-Packet? Or is there a chance
to manually register the needed files?
I have installed VMware vCenter Update Manager PowerCLI 4.1 on a Windows XP Sp3 PC without any problem. Maybe there is something wrong with your PowerCLI installation? Can you try to first deinstall VMware vSphere PowerCLI and VMware VIX and then install PowerCLI 4.1U1 again? I hope the installation of VMware vCenter Update Manager PowerCLI 4.1 will succeed after this.
Hi Robert,
mysterious mysterious 🙂 but after many uninstalls and installs it worked 🙂