Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the necessary VMware PowerCLI functions for Windows system administrators

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article analyzes "what are the necessary VMware PowerCLI functions for Windows system administrators?" The content is detailed and easy to understand, "what are the necessary VMware PowerCLI functions for Windows system administrators?" interested friends can follow the editor's ideas to read it slowly and deeply. I hope it will be helpful to everyone after reading. Let's follow the editor to learn more about "what are the necessary VMware PowerCLI functions for Windows system administrators".

If you are a Windows administrator and have recently taken on the task of taking over VMware vSphere 4, it will be nice to know that your familiar and beloved PowerShell platform can also manage the VMware environment.

Contrary to popular belief, VMware is used to help administrators get the job done, although it involves stealing Microsoft technology when needed. Entering PowerCLI and setting up PowerCLI for use is just a "next-next-complete" installation based on the existing Windows PowerCLI installation.

One of the questions that Windows administrators often ask is whether they need to learn Linux. My answer to this is that you really should forget about learning Linux and ESX control instructions. Not only is the value of those technologies diminished once ESXi becomes the VMware standard, but also because ESX controls do not provide many instructions. In contrast, there are hundreds of instruction sets in PowerCLI that provide a degree of functionality and unavailable control within the console environment.

Let's look at some of the most important uses of PowerCLI.

Create a data center using PowerCLI

Some examples of the value of PowerCLI are that these instruction sets allow you to create objects in vCenter. I have been using these instructions when disassembling, resetting, and rebuilding my experimental platform, but they can also be used to extend a new virtual data center.

Once vCenter is installed, your main task will be to create data centers, clusters, and resource pools. If you pursue consistency and automation, you can do this by using PowerCLI. To create a new data center, you need to connect to the relevant vCenter (Connect-VISServer), and then use this new data center directive to create a data center object.

The * part of the PowerCLI script connects to vCenter only through an administrative account, and the second part sets up a variable called "$root" to set the location for creating a data center. If the get folder instruction runs with a non-recursive transformation, the location of the new data center will be set at the top of the vCenter tree. As shown below, setting the names of my three data centers (UpTown, MidTown, and DownTown) with this new data center directive and the-name variable is a simple process.

Connect-viservervcnyc.corp-username corp\ administrator-passwordPassword1 $root = Get-Folder-NoRecursionnew-datacenter-location $root-name 'NYC DataCenter-UpTown'new-datacenter-location $root-name' NYC DataCenter-MidTown'new-datacenter-location $root-name 'NYC DataCenter-DownTown'

The screenshot below shows the results of each command.

Figure 1. Use PowerCLI to import data center objects

Create a cluster with PowerCLI

The next thing you want to do, of course, is to start creating VWware clusters in each of your data centers, which can be done with new cluster instructions that support a number of options to help you easily configure VMware high efficiency (HA) and distributed resource centers (DRS) for your cluster. In the following PowerCLI script, I created a cluster called "Cluster" in "NYC DataCenter-Downtown", which is really added with the following additional parameters:

New-cluster-location (get-datacenter-name 'NYC DataCenter-DownTown')-name' Cluster'-HAEnabled-HAAdmissionControlEnabled-HAFailoverLevel 2-DRSEnabled-DRSMode PartiallyAutomated

Therefore, using-HAEnabled can activate the HA and DRS technology of VMware on the cluster, setting the-HAFailover level to 2, which means that I can bear the loss of up to 2 ESX hosts before the virtual machine failure backup stops working. This is a simple way to ensure that the system does not become overloaded in the event of a considerable number of host failures.

The DRS mode parameters offer three options (semi-automatic, fully automatic, and manual), each in turn providing more and more automation. For example, when the virtual machine is powered on, the semi-automatic option allows the cluster to decide which ESX host VM is running on. Keep in mind that administrators will still be informed when DRS thinks it's a good idea to move VM and basically control the checkbox on the main DRS section of the cluster mobility dialog.

Figure 2. Automatic level of VM cluster settings

Create a resource pool with PowerCLI

Perhaps the next stage will be to define resource pools on the VMware cluster. As you know, VMware resource pooling is a way to collect large resources of a VMware cluster and divide them into easy management units. It is common to create a resource pool for each application type (such as active directory domain controllers, SQL servers, etc.). You can automate it by using the new-resourcepool directive, which, as with other instructions we use, requires setting the location parameter and creating the name of the resource pool. Repeat this process and you have created all the resource pools you need.

New-resourcepool-location (get-datacenter-name 'NYC DataCenter-DownTown' | get-cluster-name' Cluster')-name 'Web Servers'new-resourcepool-location (get-datacenter-name' NYC DataCenter-DownTown' | get-cluster-name 'Cluster')-name' Database Servers'

The interesting thing about using PowerCLI in this way is that you usually add the ESX hosts you need to the cluster before creating a resource pool, but with PowerCLI you can create your resource pool before adding ESX hosts. The following is a good example of how PowerCLI performs tasks that vSphere clients typically reject.

Figure 3. Create a resource pool using PowerCLI

Add ESX hosts through PowerCLI

The next big task for the administrator involves adding ESX hosts to the cluster, which can be done through the add-vmhostcmdlet directive in PowerCLI.

Add-vmhost esx1.corp.com-location (get-datacenter-name 'NYC DataCenter- DownTown' | get-cluster-name' Cluster')-user root-password Password1-force

By using the get-datacenter and get-cluster directives together, we can explicitly specify that an object in vCenter is the ESX host that will be added to the correct location in the directory. Adding them to the HA cluster also triggers the startup of the HA agent to the ESX host.

Here, the-force parameter is used to receive the default SSL certificate generated during the installation of the ESX host. If there is no-force parameter, in order to successfully add the ESX host to the vCenter, you need to fully trust the SSL certificate; otherwise, the task will fail with an error message: "the authorization of the specified host is invalid because the self-signed SSL certificate is being used."

Figure 4. Add ESX hosts to the cluster

As you can see, PowerCLI is very powerful, and its value lies in its ability to easily automate tasks. If you have mastered the basics of Windows PowerShell, it is relatively easy to learn the additional instructions in VMware.

Year after year, VMware adds more instructions to make your daily management of your work life easier, but you can also go beyond those instructions if you want. PowerCLI can be used in conjunction with VMware's SDK through a web server engine, so that virtually all the tasks you perform on the vSphere client can be automatically performed with PowerCLI through SDK. VMware's new PowerCLI version allows you to access the configuration options you need with a simple command, but until then, the above approach is a good choice.

About Windows system administrator must have VMware PowerCLI function which shares here, hoped that the above content can let everybody have the promotion. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report