new1234.jpg

Archive

Posts Tagged ‘PowerCLI’

VMware: Disable HotPlug capability for virtual machines with PowerCLI

January 16th, 2016 2 comments

Last week I had to change VMX files for 500 XenDesktop machines because the users where able to eject removable devices

To mass disable HotPlug capability by editing the .vmx file via PowerCLI I used the following script:

$key = "devices.hotplug"
$value = "false"
get-cluster "CL02.XD" | get-VM -Name 000-CXD* | foreach {
  $vm = Get-View $_.Id
  $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
  $vmConfigSpec.extraconfig += New-Object VMware.Vim.optionvalue
  $vmConfigSpec.extraconfig[0].Key=$key
  $vmConfigSpec.extraconfig[0].Value=$value
  $vm.ReconfigVM($vmConfigSpec)
}


Optional (manual) options:

You can disable HotPlug capability using the vSphere Client or by editing the .vmx file.
Note: You can disable HotPlug capability for PCI devices such as e1000 or vmxnet3 NICs.
To disable HotPlug capability using the vSphere Client:

  1. Connect to the ESXi/ESX host or vCenter Server using the vSphere Client.
  2. Power off the virtual machine.
  3. Right-click the virtual machine and click Edit Settings.
  4. Click the Options tab.
  5. Click General > Configuration Parameters > Add Row.
  6. Insert a new row with the name devices.hotplug and a value of false.
  7. Power on the virtual machine.

To disable HotPlug capability using the vSphere Web Client:

  1. From a web browser, connect to the vSphere Web Client.
  2. Log in with Administrator credentials.
  3. Navigate to the virtual machine you want to modify.
  4. Right-click the virtual machine and select Edit Settings.
  5. Click the VM Options tab.
  6. Click Advanced > Edit Configuration > Add Row.
  7. Insert a new row with the name devices.hotplug and a value of false.
  8. Power on the virtual machine.

To disable HotPlug capability by editing the .vmx file:

  1. Power off the virtual machine.
  2. Access the ESXi/ESX service console using an SSH client.
  3. Open the virtual machine configuration file (.vmx) in a text editor. The default location is:
    /vmfs/volumes/datastore_name/vm_name/vm_name.vmx
  4. Add the line:
    devices.hotplug = "false"
    Note: This setting does not interfere with HotPlug CPU/memory.
  5. Save and close the file.
  6. Power on the virtual machine.
    More information:

VMware

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

VMware: Could not connect using the requested protocol [PowerCLI]

October 26th, 2015 1 comment

Connecting from workstation with PowerCLI to VMware vCenter 6.0 appliance fails with error:

Could not connect using the requested protocol

image

 

 

 

 

Solution

This issue occurs due to the proxy settings in the environment. To resolve this, check the proxy settings using the PowerCLI and set the proxy to “No Proxy”.

To set the proxy setting to No Proxy:

Run this command to find the current proxy settings:

Get-PowerCLIConfiguration

image

 

 

 

 

 

To change this setting, run this command:

Set-PowerCLIConfiguration -ProxyPolicy NoProxy -Confirm

image

 

 

 

 

 

Result

image

 

 

 

 

 

More information: VMware

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

VMware: Configure new vSphere 6 host with PowerCLI

August 17th, 2015 2 comments

Last week I upgraded my original Configure vSphere 4 PowerCLI script I created in 2011 . When you run the script with PowerShell ICE or PowerCLI you have two options: 1. Configure a new vSphere 6 host. 2. Add the new configured host to vCenter Server. I’m still not a PowerCLI Pro so.. please comment if you have any tips or suggestions.

Benefits:

— When you use this script, the script is your vSphere configuration documentation
— You don’t need a license for Host Profiles or revert temporary to Evaluation Mode
— Fresh (new) host configuration takes ~10 minutes
— vSphere Host configuration standardization
— Easy add variables during deployment
— Easy GUI menu

 

Function:

Menu option: 1 – Configure new vSphere host

— Connect to the target ESXi Host
— Enter Maintenance mode
— Set Hostname and Domain name
— Configure DNS settings
— Configure NTP settings
— Configuring Simple Network Management Protocol (SNMP)
— Delete the default VM Network
— Configure vSwitch0 – Management / vMotion
— Configure vSwitch1 – Production Network
— Configure vSwitch2 – iSCSI
— Configure vSwitch3 – iSCSI
— Install Software iSCSI Initiator
— Configure iSCSI target address
— Configure iSCSI initiator name
— Enable iSCSI Initiator
— Rescan on all HBAs and Rescan for VMFS volumes
— Exit Maintenance Mode

Menu option: 2 – Configure new vSphere host to vCenter Server

— Connect vCenter server
— Add vSphere Host to vCenter server
— Re-balance Cluster

Menu option: 0 – Quit

 


Script upgraded for hardware setup:

Host

— Type: Dell PowerEdge R630
— Network: 6x 10 GB
— Storage: flash (2×8 GB)
— Memory: 256 GB
— CPU:  2x E5-2660 v3

Storage

— Dell Compellent SC4020 (iSCSI)

Network

— DellForce 10


Script:

#====================================================================#
#   SCRIPT:        VMP_Configure_new_vSphere6_Host_with_Menu.ps1     #
#   FUNCTION:      Configure fresh installed host                    #
#   CREATED:       05/07/2011                                        #
#   MODIFIED:      17/08/2015                                        #
#   OWNER:         S.Daems / VMpros.nl                               #
#   VERSION:       v.1.7                                             #
#====================================================================#
#   CHANGELOG:                                                       #
#                                                                    #
#   v.1.7                                                            #
#                                                                    #
#    - Script upgraded to vSphere 6.0                                #
#    -- Updated obsolete commands (vSphere 6 proof)                  #
#    - Install and configure 10GB iSCSI storage network              #
#    -- Configure iSCSI initiator                                    #
#    -- Configure iSCSI initator IQN name                            #
#    - Updated and configure SMNP                                    #
#    - Updated DNS settings                                          #
#    - Updated Custom Definitions field                              #
#    - Updated Network Configuration parameters                      #
#                                                                    #
#   USAGE:                                                           #
#                                                                    #
#    - Edit script in Windows PowerShell ISE / Notepad ++            #
#    - Add static values in "Custom Definitions" section             #
#    - Run script with Windows PowerShell ISE or PowerCLI 6.0        #                                                                    #
#    - Answer dynamic values during script                           #                                                                 #
#    - Enjoy!                                                        #
#                                                                    #
#                                                                    #
#   NOTE:                                                            #
#                                                                    #
#    - Run this script only on a empty vSphere 6 host                #
#    - Check if the correct pNIC's are configured for NIC Teaming    #
#    - This script is written with VMware vSphere PowerCLI 6.0       #
#                                                                    #
#                                                                    #
#====================================================================#
#   MENU                                                             #
#====================================================================#
do {
 
Write-Host "Please make your choice:" -foregroundcolor yellow
Write-Host " 1. Configure new vSphere host"
Write-Host " 2. Configure new vSphere host to vCenter Server"
Write-Host " 0. Quit"
Write-Host " "
$response = Read-Host "Select 0-2"
Write-Host " "
 
switch ($response)
{
1 {
#====================================================================#
#   HOST = CUSTOM DEFINITIONS                                        #
#====================================================================#
$ESX_host = read-host "Select ESXi host by DNS to connect"
$New_hostname = read-host "Select hostname to configure"
$New_domainname = "VMpros.lan"
$Root_user = "root"
$Root_password = "VMpros#2015!"
$DNS01 = "10.32.17.5"
$DNS02 = "10.32.17.6"
$VMK01 = read-host "Select iSCSI VMkernel 01 IP-address to configure"
$VMK02 = read-host "Select iSCSI VMkernel 02 IP-address to configure"
$VLAN01_label = "VMP-VLAN200"
$VLAN02_label = "VMP-VLAN300"
$VLAN03_label = "VMP-VLAN400"
$VLAN04_label = "VMP-VLAN500"
$VLAN05_label = "VMP-VLAN600"
$VLAN06_label = "VMP-VLAN700"
$VLAN01_id = "200"
$VLAN02_id = "300"
$VLAN03_id = "400"
$VLAN04_id = "500"
$VLAN05_id = "600"
$VLAN06_id = "700"
$iSCSI_sub = "255.255.255.0"
$iSCSI_target_A = "172.45.21.40"
$iSCSI_target_B = "172.45.22.40"
$vMotion_ip = read-host "Select vMotion VMkernel IP-address to configure"
$vMotion_sub = "255.255.255.0"
$NTP01 = "0.nl.pool.ntp.org"
$NTP02 = "1.nl.pool.ntp.org"
$MTU = "9000"
#
#
#
#====================================================================#
# ***LOAD PLUGINS***                                                 #
#====================================================================#
Add-PSSnapin vmware.vimautomation.core
#====================================================================#
#
#
#
#====================================================================#
Write-Host "-- vSphere Host-configuration starting..." -foregroundcolor yellow
#====================================================================#
Write-Host "-- Connect to the target ESXi Host" -foregroundcolor green
#====================================================================#
Set-PowerCLIConfiguration -invalidCertificateAction "ignore" -confirm:$false | out-null
Connect-VIServer "$ESX_host" -User "$Root_user" -Password "$Root_password" | out-null
Start-Sleep -Seconds 10
#--------------------------------------------------------------------#
Write-Host "-- Enter Maintenance mode" -foregroundcolor green | out-null
#--------------------------------------------------------------------#
Get-VMHost | Set-VMHost -State maintenance | out-null
#--------------------------------------------------------------------#
#
#
#
#====================================================================#
# ***CONFIGURE HOST SETTINGS***                                      #
#====================================================================#
Write-Host "-- Set Hostname and Domain name" -foregroundcolor green
#--------------------------------------------------------------------#
Get-VMHostNetwork | Set-VMHostNetwork -DomainName $New_domainname -HostName $New_hostname | out-null
Start-Sleep -Seconds 10
#--------------------------------------------------------------------#
Write-Host "-- Configure DNS settings" -foregroundcolor green
#--------------------------------------------------------------------#
Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress "$DNS01" , "$DNS02" -SearchDomain "$New_domainname" | out-null
#--------------------------------------------------------------------#
Write-Host "-- Configure NTP settings" -foregroundcolor green
#--------------------------------------------------------------------#
Get-VMHost | Add-VmHostNtpServer -NtpServer "$NTP01" , "$NTP02" | out-null
Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq "NTP client"} | Set-VMHostFirewallException -Enabled:$true | out-null
Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Start-VMHostService | out-null
Get-VMhost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Set-VMHostService -policy "automatic" | out-null
#--------------------------------------------------------------------#
Write-Host "-- Configuring Simple Network Management Protocol (SNMP)" -foregroundcolor green
#--------------------------------------------------------------------#
Get-VMHostSNMP | Set-VMhostSnmp -ReadOnlyCommunity 'public' | out-null
Get-VMHostSnmp | Set-VMHostSnmp -Enabled:$true | out-null
#--------------------------------------------------------------------#
#
#
#
#====================================================================#
# ***CONFIGURE NETWORK SWITCHES***                                   #
#====================================================================#
Write-Host "-- Delete the default VM Network" -foregroundcolor green
#--------------------------------------------------------------------#
Get-VirtualPortGroup -Name "VM Network" | Remove-VirtualPortGroup -Confirm:$false | out-null
#--------------------------------------------------------------------#
Write-Host "-- Configure vSwitch0 - Management / vMotion" -foregroundcolor green
#--------------------------------------------------------------------#
Get-VirtualSwitch -Name vSwitch0 | Set-VirtualSwitch -Nic vmnic0,vmnic7 -Confirm:$false | out-null
New-VMHostNetworkAdapter -PortGroup vMotion -VirtualSwitch vSwitch0 -IP "$vMotion_ip" -SubnetMask "$vMotion_sub" -vMotionEnabled:$true -Confirm:$false | out-null
Get-virtualportgroup -name vMotion | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive vmnic7 | out-null
Get-virtualportgroup -name vMotion | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicStandby vmnic0 | out-null
Get-virtualportgroup -name "Management Network" | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicStandby vmnic7 | out-null
Get-virtualportgroup -name "Management Network" | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive vmnic0 | out-null
#--------------------------------------------------------------------#
Write-Host "-- Configure vSwitch1 - Production Network" -foregroundcolor green
#--------------------------------------------------------------------#
New-VirtualSwitch -Name vSwitch1 -Nic vmnic4,vmnic6 -Confirm:$false | out-null
Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name "$VLAN01_label" -VLANID "$VLAN01_id" | out-null
Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name "$VLAN02_label" -VLANID "$VLAN02_id" | out-null
Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name "$VLAN03_label" -VLANID "$VLAN03_id" | out-null
Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name "$VLAN04_label" -VLANID "$VLAN04_id" | out-null
Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name "$VLAN05_label" -VLANID "$VLAN05_id" | out-null
Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name "$VLAN06_label" -VLANID "$VLAN06_id" | out-null
#--------------------------------------------------------------------#
Write-Host "-- Configure vSwitch2 - iSCSI" -foregroundcolor green
#--------------------------------------------------------------------#
New-VirtualSwitch -Name vSwitch2 -Nic vmnic5 -MTU $MTU | out-null
New-VMHostNetworkAdapter -PortGroup "iSCSI01" -VirtualSwitch vSwitch2 -IP $VMK01 -SubnetMask "$iSCSI_sub" -MTU "$MTU" | out-null
#--------------------------------------------------------------------#
Write-Host "-- Configure vSwitch3 - iSCSI" -foregroundcolor green
#--------------------------------------------------------------------#
New-VirtualSwitch -Name vSwitch3 -Nic vmnic1 -MTU $MTU | out-null
New-VMHostNetworkAdapter -PortGroup "iSCSI02" -VirtualSwitch vSwitch3 -IP $VMK02 -SubnetMask "$iSCSI_sub" -MTU "$MTU" | out-null
#------------------------------------------------------------------
#
#
#
#=====================================================================#
# ***CONFIGURE STORAGE***                                             #
#=====================================================================#
Write-Host "-- Install Software iSCSI Initiator" -foregroundcolor green
#---------------------------------------------------------------------#
Get-VMHostStorage $ESX_host | Set-VMHostStorage -SoftwareIScsiEnabled $false | out-null
Start-Sleep -Seconds 15 
#---------------------------------------------------------------------#
Write-Host "-- Configure iSCSI target address" -foregroundcolor green
#---------------------------------------------------------------------#
$iSCSI_HBA = Get-VMHost | Get-VMHostHba | Where {$_.Type -eq "Iscsi"} | Where {$_.Model -eq "iSCSI Software Adapter"}
Get-VMHostHba "$iSCSI_HBA" | New-IScsiHbaTarget -Address "$iSCSI_target_A" | out-null
Get-VMHostHba "$iSCSI_HBA" | New-IScsiHbaTarget -Address "$iSCSI_target_B" | out-null
#---------------------------------------------------------------------#
Write-Host "-- Configure iSCSI initiator name" -foregroundcolor green
#---------------------------------------------------------------------#
Get-VMHost | Get-VMHostHba | Where {$_.Type -eq "Iscsi"} | Where {$_.Model -eq "iSCSI Software Adapter"} | Set-VMHostHba -IScsiName "iqn.1998-01.com.vmware$ESX_host" | out-null
#---------------------------------------------------------------------#
Write-Host "-- Enable iSCSI Initiator" -foregroundcolor green
#---------------------------------------------------------------------#
Get-VMHostStorage $ESX_host | Set-VMHostStorage -SoftwareIScsiEnabled $True | out-null
#---------------------------------------------------------------------#
Write-Host "-- Rescan on all HBAs and Rescan for VMFS volumes" -foregroundcolor green
#---------------------------------------------------------------------#
Get-VMHostStorage -VMHost $ESX_host -RescanAllHba | out-null
Get-VMHostStorage -VMHost $ESX_host -RescanVmfs | out-null
#---------------------------------------------------------------------#
#
#
#
#=====================================================================#
# ***FINISHING CONFIGURATION***                                       #
#=====================================================================#
Write-Host "-- Exit Maintenance Mode" -foregroundcolor green
#---------------------------------------------------------------------#
Get-VMHost | Set-VMHost -State connected | out-null
#---------------------------------------------------------------------#
#
#
#
Write-Host "vSphere Host-configuration has finished.." -foregroundcolor yellow
break;
}
2 {
#====================================================================#
#   vCenter - CUSTOM DEFINITIONS                                     #
#====================================================================#
$vCenter_server = read-host "Select vCenter server to connect"
$vCenter_administrator = read-host "Select vCenter Administrator"
$vCenter_password = read-host "Select vCenter Administrator password"
$vCenter_cluster = read-host "Select Cluster to add host"
Write-Host "vSphere Host will be added in vCenter server..." -foregroundcolor Green
#====================================================================#
Write-Host "Connect to the target vCenter server" -foregroundcolor green
#====================================================================#
Connect-VIServer "$vCenter_server" -User "$vCenter_administrator" -Password "$vCenter_password"
#====================================================================#
Add-VMHost $ESX_host -Force -Location (Get-Cluster "$vCenter_cluster") -User root -Password "$Root_password" | out-null
#====================================================================#
#
#
#
#====================================================================#
# ***FINISHING CONFIGURATION***                                      #
#====================================================================#
Write-Host "Re-balance VMs in cluster using DRS" -foregroundcolor green
#====================================================================#
Get-DrsRecommendation -Cluster (Get-Cluster "$vCenter_cluster") -Refresh | out-null
#====================================================================#
#
#
#
Write-Host "Host is added to vCenter Server.." -foregroundcolor yellow
break;
}
}
 
}
while ($response -ne "0")

 

 

Script output:

image

 

 

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

VMware: Detach unmounted datastores with PowerCLI

June 29th, 2014 7 comments

Last week I  had some issues with unmounting some old datastores in a vSphere 5.5 environment. In the GUI it look like:

image

When I tried to unmount / detach the datastore I received this error message::

Call “HostDatastoreSystem.RemoveDatastore” for object “datastoreSystem-330” on vCenter Server “itvvca01.domain.local” failed.
Operation failed, diagnostics report: Unable to query live VMFS state of volume.: No such file or directory

More information:

image

SAN01_VMFS04 datastore state accessible: false….

image

 

Solution:

You can easy detach the inaccessible datastores with the following command:

Get-Datastore SAN01_VMFS0* | Unmount-Datastore

Or per specific datastore:

Get-Datastore SAN01_VMFS01 | Unmount-Datastore

Get-Datastore SAN01_VMFS02 | Unmount-Datastore

More information: VMware

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

Categories: VMware Tags: , , ,

VMware: Configure vSphere hosts to VMware Syslog Collector with PowerCLI

December 18th, 2013 2 comments

PowerCLI script:

 

#====================================================================#
#   SCRIPT:        PowerCLI_configure_syslog_settings_host.ps1       #
#   FUNCTION:      Add remote syslog server, settings and  open      #
#                  firewall ports in cluster                         #
#   OWNER:         Sander Daems                                      #
#   VSPHERE:       5.5 build 1331820                                 #
#   CREATED:       18/12/2013                                        #
#   MODIFIED:      18/12/2013                                        #
#   VERSION:       v.1.0                                             #
#====================================================================#
#   CHANGELOG:                                                       #
#                                                                    #
#    v.1.0                                                           #
#    - Script created;                                               #
#                                                                    #
#====================================================================#
# CUSTOM DEFINITIONS                                                 #
#====================================================================#
$vCenterServer = Read-Host "Enter vCenter Hostname / IP"
$vmhost = Get-VMHost
#====================================================================#
# HOST - Specify host and connect                                    #
#====================================================================#
Connect-VIServer $vCenterServer
#====================================================================#
# SCRIPT - SYSLOG - Update Syslog settings                           #
#====================================================================#
$vmhost | Set-VMHostAdvancedConfiguration -NameValue @{'Config.HostAgent.log.level'='info';'Vpx.Vpxa.config.log.level'='info';'Syslog.global.logHost'='udp://10.180.200.18:514'}
#====================================================================#
# SCRIPT - FIREWALL - Open ESXi firewall port                        #
#====================================================================#
$vmhost | Get-VMHostFirewallException -VMhost $vmhost -name syslog | Set-VMHostFirewallException -Enabled $true
#====================================================================#

 

vCenter Syslog Collector settings:

 

image


Script result:

image

image

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

VMware: Cannot delete virtual machine from disk with more then 100 active snapshots

March 19th, 2013 1 comment

Today I tried to delete a virtual machine with more then 100 (damn Backup Exec) snapshots, in the vSphere Client I selected in the inventory:  “Delete from disk”  , few seconds later I received this error message:

Cannot complete the operation due to an incorrect request to the server

image

Events directly at the vSphere 5.0 host:

Warning message from ESXHOST: This virtual machine has more than 100 redo logs in a single branch of its snapshot tree. Deleting some of the snapshots or consolidating the redo logs will improve performance. The maximum number of redo logs supported is 255.

Virtual machine disks consolidation failed.


Solution:

With this simple PowerCLI command I was able to remove the virtual machine include all active snapshots

Remove-VM "VM" -DeletePermanently -Confirm:$false

image

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

VMware: Mass change portgroup VM’s in cluster with PowerCLI

January 10th, 2013 3 comments

Last week I configured for a customer some new VLAN’s and created on each host new vSwitches with new portgroups, to migrate all VM’s in cluster with network label “VM Network” to “Production” I’ve created this script to automate this for all virtual machines with specific network label in cluster:

Original situation:

image


Script
:

#====================================================================#
#   SCRIPT:        PowerCLI_Mass_change_network_label.ps1            #
#   FUNCTION:      Mass change network label Network A to Network B  #
#   OWNER:         Sander Daems                                      #
#   VSPHERE:       5.0 Update 1 build 623860                         #
#   CREATED:       10/01/2013                                        #
#   MODIFIED:      10/01/2013                                        #
#   VERSION:       v.1.0                                             #
#====================================================================#
#   CHANGELOG:                                                       #
#                                                                    #
#    v.1.0                                                           #
#    - Script created;                                               #
#                                                                    #
#====================================================================#
#   HOST - Specify host and connect                                  #
#====================================================================#
$vCenterServer = Read-Host "Enter vCenter Hostname / IP"
Connect-VIServer $vCenterServer
#
#====================================================================#
# CUSTOM DEFINITIONS                                                 #
#====================================================================#
$Cluster = "Cluster01" 
$SourcePortgroup = "VM Network" 
$DestinationPortgroup = "Production" 
#
#====================================================================#
# SCRIPT                                                             #
#====================================================================#
Get-Cluster $Cluster | Get-VM | Get-NetworkAdapter | Where {$_.NetworkName -eq $SourcePortgroup } | Set-NetworkAdapter -NetworkName $DestinationPortgroup -Confirm:$false#====================================================================#

 

Result:


New situation
 (All VM’s in cluster):

image

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

VMware: Configure NetApp NFS datastore(s) Advanced parameters with PowerCLI

January 7th, 2013 3 comments

The settings that NetApp recommends (across all ESX hosts) are:

– NFS.HeartbeatFrequency(NFS.HeartbeatDelta in vSphere) = 12
– NFS.HeartbeatTimeout = 5 (default)
– NFS.HeartbeatMaxFailures = 10

When the number of NFS datastores are increased, we also recommend increasing the heap values:
– Net.TcpipHeapSize =>’30’  to Net.TcpipHeapMax  => ‘120’

To automate this configuration I’ve wrote a PowerCLI script:

#====================================================================#
#   SCRIPT:        Configure_Advanced_NFS_parameters.ps1             #
#   FUNCTION:      Configure NFS / NetApp best practice              #
#   OWNER:         Sander Daems                                      #
#   VENDOR:        NetApp / FAS2040                                  #
#   VSPHERE:       5.0 Update 1 build 623860                         #
#   CREATED:       07/01/2013                                        #
#   MODIFIED:      20/03/2013                                        #
#   VERSION:       v.1.1                                             #
#====================================================================#
#   CHANGELOG:                                                       #
#                                                                    #
#    v.1.0                                                           #
#    - Created script;                                               #
#                                                                    #
#====================================================================#
#   HOST - Specify host and connect                                  #
#====================================================================#
$ESXiHost = Read-Host "Enter ESXi Host name or IP"
Connect-VIServer $ESXiHost
#====================================================================# 
#   ADVANCED - Update TCP Settings                                   #
#====================================================================#
Set-VMHostAdvancedConfiguration -VMHost $ESXiHost -Name Net.TcpipHeapSize -Value 32
Set-VMHostAdvancedConfiguration -VMHost $ESXiHost -Name Net.TcpipHeapMax -Value 128
#====================================================================#
#   ADVANCED - Update NFS Settings                                   #
#====================================================================#
Set-VMHostAdvancedConfiguration -VMHost $ESXiHost -Name NFS.MaxVolumes -Value 256
Set-VMHostAdvancedConfiguration -VMHost $ESXiHost -Name NFS.HeartbeatMaxFailures -Value 10
Set-VMHostAdvancedConfiguration -VMHost $ESXiHost -Name NFS.HeartbeatFrequency -Value 12
Set-VMHostAdvancedConfiguration -VMHost $ESXiHost -Name NFS.HeartbeatTimeout -Value 5
#====================================================================#
#   SCRIPT FINISHED                                        #
#====================================================================#
Write-Host "Script finished..." -foregroundcolor yellow
#====================================================================#

More information / source: NetApp Whitepaper

More information / source: VMware KB , VMware KB, VMware KB

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

VMware: Install Dell Equallogic Multipathing Extension (PSP) for vSphere 5.1 with PowerCLI

October 23rd, 2012 3 comments

Last week I’ve installed some Dell hosts with VMware vSphere 5.1 and used Dell Eq. PS6000 storage. To configure the connection between host and storage optimal I’ve used the Dell Equallogic Multipathing Extension witch is supported for vSphere 5.x

The SATP VMW_SATP_EQL is a VMware default one for EqualLogic arrays. And of course the PSP is DELL_PSP_EQL_ROUTED. The ‘ROUTED’ part refers ot DELL’s MEM being able to intelligently route I/O requests to the array path best suited to handle the request, to configure this with PowerCLI I’ve used the following code:

Get-VMHost HOST | Install-VMHostPatch -HostPath "/vmfs/volumes/VMFS-009-SSD/dell-eql-mem-esx5-1.1.1.270268/metadata.zip"

image

image

 

Result:

The DELL_PSP_EQL_ROUTED is configured automatically and the path selection is selected

image

 

Source and more information: VMware , VMware, Dell

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

Categories: VMware Tags: , , , ,