Tech Center

This page is a home for my technology related posts.

Disclaimer!

The views, information or opinions expressed on this site are my own and do not represent my current/future employer or customer.

The author of the information takes no responsibility of any damages that may occur using the information.

You are free to share or redistribute the information as you seem fit.

Find VMs with unwanted devices

Introduction: As an administrator for a vSphere environment you may come across situation where you have a lot of VMs configured with unnecessary hardware like USB device, Floppy disk or a serial device. The presence of such devices can impact the efficiency of DRS leading to the imbalanced cluster. In a large-scale environment, it can be difficult to find and fix such VMs. The code below provides an ability to create a csv report for the device specified ($hwtype) Code: Start-Transcript -Append -Path "$env:USERPROFILE\Documents\usbfinder.log" $vCenterIP = Read-Host "Enter vCenter IP or Name where the operation needs to be executed" Connect-VIServer $vCenterIP echo "VM Name,HW Label,HW Summary" | out-file "$env:USERPROFILE\Documents\VMsWithUsb.csv" $VMs = Get-VM #update this variable to change the type of hardware “floppy" or "serial" or "usb” $hwtype = “usb” foreach ($VM in $vms) { $VMname = $VM.Name $hardware=(Get-VM $VMname | Get-View).Config.Hardware.Device | Select -Expand DeviceInfo | Select Label, Summary | ...

Provision a limited access Domain user on an ESXi

Introduction: While working with ESXi 6.5 & 6.7 I noticed that there is no UI option available to provision a domain user. The PowerCLI cmdlet New-VIPermission also fails to query and add permission for domain user. The only option to achieve this is using SSH session to the host. The command that can be used on the SSH console to achieve this is Syntax: vim-cmd vimsvc/auth/entity_permission_add <Folder> <user/group> <isGroup> <Role> <propagate> Sample command: vim-cmd vimsvc/auth/entity_permission_add vim.Folder:ha-folder-root '[email protected]' false 'ManageUsers' yes This can be a night mare for a large-scale setup. This blog presents a PowerCLI based solution to this issue. Dependencies:
  • The solution uses plink.exe. Hence, make sure to install Putty before using the code presented
  • Working PoweCLI setup. You may refer here for details
  • The ESXi host SSH keys must be part of Putty known hosts prior to executing the code presented
Code: Start-Transcript -Append -Path "$env:USERPROFILE\Documents\creatuser.log" $vCenterIP = Read-Host "Enter ...

vSphere HA Slots Policy Demystified

Introduction: When you choose Slot policy, the failover capacity is ensured using a Slot based approach. In vSphere release 6.5 and above you may choose a fixed slot size as well What is a Slot and Slot Size ? If we assume an ESXi to be a car parking lot, A Slot is a space where a VM (VM is the car here) can parked and Slot Size is the dimension of individual parking spot. Lets say you have a task at hand of converting a huge arear to a Car park with fixed dimensions of an individual parking slots. How will you do it? One way to do this to find the Length of the longest vehicle (LV) and the Width of the widest vehicle (WV) that can visit this car park. Hence, dividing the whole area into slots of size LV * WV Unfortunately this is not what ...

Impact of Traffic Shaping

A traffic shaping policy is defined by average bandwidth, peak bandwidth, and burst size. You can establish a traffic shaping policy for each port group and each distributed port or distributed port group. ESXi shapes outbound network traffic on standard switches and inbound and outbound traffic on distributed switches. Traffic shaping restricts the network bandwidth available on a port, but can also be configured to allow bursts of traffic to flow through at higher speeds. Average Bandwidth: Establishes the number of bits per second to allow across a port, averaged over time. This number is the allowed average load. Peak Bandwidth: Maximum number of bits per second to allow across a port when it is sending or receiving a burst of traffic. This number limits the bandwidth that a port uses when it is using its burst bonus. Burst Size: Maximum number of bytes to allow in a burst. If ...
/ / Network, The Tech Center

PowerCLI to Clone a DVS

Scripted Operations:
  1. DVS Creation with the user provided name
  2. PortGroup Creation on the new DVS by reading the settings from the user provided existing DVS
  3. Host additions to the new DVS by reading the settings from the user provided existing DVS
  4. Migration of All but one Physical up-links to the new DVS by reading the settings from the user provided existing DVS
  5. Migration of VMs to the new DSV
  6. Migration of last Physical up-link to the new DVS by reading the settings from the user provided existing DVS
Script Workflow: Code: Start-Transcript -Append -Path "$env:USERPROFILE\Documents\DVScopy.log" $vCenterIP = Read-Host "Enter vCenter IP or Name where the operation needs to be executed" $myDatacenter = Read-Host "Enter Datacenter Name where the operation needs to be executed" $Cluster = Read-Host "Enter Cluster Name where the operation needs to be executed" $NewDVS = Read-Host "Enter a Name for the New DVS" $NumUplinks = Read-Host "Enter the number of uplink ...
/ / PowerCLI, The Tech Center