Category: PowerCLI

Posts related to PowerCLI

Adding the host to Distributed switch and Mapping the VMs [V2]

A few days ago, I posted a DVS management script that added hosts, uplinks and mapped VM based on user inputs in the form of prompts and csv file. A colleague of mine used that script and found a use case where it could be seriously destructive. I will refer to that as V1 script in rest of the post Failed use case: The V1 script  made use of Auto assign vmnic to DVS uplink.

Advertisements
Continue reading

Adding the host to Distributed switch and Mapping the VMs [V1]

Hello 2020 and my fist technical post of  the year. Use case: You have built a new vCenter from scratch and would like to move host from an existing vCenter server to this one. As a preparation for this migration you performed following steps 1 Created Network mapping of all VMs in the source vCenter server 2 Exported the Distributed switch configuration from the source vCenter server 3 Imported the Distributed switch configuration to the

Continue reading

Reset Syslog.Global.Loghost to blank

This morning I worked with the customer where syslog traffic was choking an already crippled network.   As a quick fix we wanted to spare the  network from syslog data being generated by ESXi hosts. The only problem was that we had a few hundred host at hand. SSH and UI was not an option.

Continue reading

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

Continue reading

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: Sample command: This can be a night mare for a large-scale

Continue reading

PowerCLI to Clone a DVS

Scripted Operations: DVS Creation with the user provided name PortGroup Creation on the new DVS by reading the settings from the user provided existing DVS Host additions to the new DVS by reading the settings from the user provided existing DVS Migration of All but one Physical up-links to the new DVS by reading the settings from the user provided existing DVS Migration of VMs to the new DSV Migration of last  Physical up-link to

Continue reading

Setup VMware PowerCLI environment using offline modules

From a past few version VMware has stopped shipping an installer for PowerCLI. The latest builds of PowerCLI run as modules within PowerShell environment. Download Location: Download the latest versions of  VMware PowerCLI offline modules  from VMware site. https://code.vmware.com/web/tool/11.2.0/vmware-powercli The offline modules are distributed as a zip file Prepare the Environment(Per user):  Open command prompt and run: echo %userprofile%. This will print the location of the user profile (currently logged in user) on the system

Continue reading

Isolating Stale VMDKs

Step 1: Generate a list of vmdk associated with the VMs In this step, we will generate a list of VMDKs associated with all the VMs registered on a vCenter server. Save the following code as a PowerShell script Script 1: Connect to the vCenter server using following command Execute the script 1 The execution of the above script will generate VmInfo.csv at the path of execution. Step 2: Generate a list of vmdks associated

Continue reading