Tagged: PowerCLI

PowerCLI is a Windows PowerShell interface for managing VMware vSphere. VMware describes PowerCLI as “a powerful command-line tool that lets you automate all aspects of vSphere management, including network, storage, VM, guest OS and more.

PowerCLI 0

[Script]: Check Time Synchronization with Host on Virtual Machines – PowerCLI

As you know, virtual machines can sync their time with ESXi host when VMware Tools is installed on the virtual machines. Also the configuration should be enabled on virtual machine configuration manually. The configuration is available on “Virtual Machine Properties”: If there is more than one virtual machine (Absolutely YES), the configuration should be enabled via an automation solution such as PowerCLI because enabling the configuration manually is very difficult. As all virtual machines don’t need to this configuration for time synchronization, administrators enables the configuration for some VMs when it needed. Some times, administrators have to provide a report from the virtual machines which have the configuration enabled. So how an administrator be able to create a query from the virtual machine. The stupid solution is checking virtual machine via GUI one by one. But true solution is create query from virtual machine via an automation tools such as PowerCLI The Script! Administrator can run the below PowerCLI script to find the virtual machines with “Synchronize guest time with host” configuration: The {File Path} should be changed with actual file path for storing the information as CSV file. More on Tiemouri.Net VMware Tools Client – Interact with a VM...

PowerCLI 11

Change Linux IP Address via PowerCLI

There is some reason that you want to change IP address on virtual machines as an example, moving virtual machines to a new VLAN or port-group or moving them to another site or replicate virtual machine to an offsite recovery site. Changing IP on machines one by one is very difficult on more than one machine and it be tougher. PowerCLI has cmdlet that it called “Invoke-VMScript”, the cmdlet lets you to run scripts on guest OS even when guest OS has no IP. But VMware Tools must be installed and also updated VMware Tools is recommended. Also you must have guest OS credential to run your script. Sample Script for Change IP Address Here is a sample script to change address on multiple VM and also change NFS mount point addresses on “fstab” file. Before run, you must customize the below script and put proper network configuration file within the script: Further Reading Add existing virtual desktops to “Automated Pool” in VMware View manually [PowerCLI]: Change Local Account Password on ESXi [Script]: Find ESXi HBA WWN via PowerCLI Veeam Backup & Replication – Re-IP Rule on Linux VM

PowerCLI 4

[PowerCLI]: Change Local Account Password on ESXi

Usually, administrators using same password on all servers for easier management and there is some security reasons to change the password periodically such as defining an expire time for password or when one of members is left company. Changing user’s password or many users password on a single host is too easy but what about more than host? You know, VMware has provided some automation tools such as PowerCLI. The automation tools will help administrators to do their tasks much easier and faster than GUI. In this post, you’ll find a simple solution for changing multiple users password on multiple ESXi hosts. The Script! The below script will help you to change a user account’s password on multiple ESXi servers: I’ll publish another script to change multiple accounts password with multiple passwords on multiple ESXi servers. Read More on Teimouri.net [PowerCLI]: Add Local Administrator Account on ESXi Using Client Information in VMware View VMware Tools Client – Interact with a VM without Network Connectivity VMware View Pool Entitelement Cleanup Run ESXi Commands Via PowerShell And SSH ESXi Command-Line – Part 1 [Script]: Find ESXi HBA WWN via PowerCLI Check CPU, Memory and Storage OverCommitment – PowerCLI

PowerCLI 5

PowerCLI: Best Solution to Add Local Administrator Account on ESXi 5.x and Newer

The is some reason to have local user on ESXi servers even when there is vCenter server for management such as vCenter is inaccessible. You can use root user for doing operations on ESXi directly but some times, you have to ask someone to do the operations and then you will not have any tacking and all operation will be done by root user. So create user for trusted colleagues will help you to manage ESXi and track each user about what has he done. User creation is too easy, you can create users via vSphere Client (C# Client or Web Client) or by run some scripts. PowerCLI is automation tools for VMware products and you can use it for create more than one users by run few lines of script. The PowerCLI Script! You can use the below script for create users and assign proper roles to them but you must change something in the below script and customize it to use: The above script will create users with Administrator role and each user be able to manage all object under root folder. Also you can create group for different users and assign the role to the group instead...

PowerCLI 0

[PowerCLI]: ESXi Syslog Configuration via PowerCLI

What’s Syslog? Syslog is a standard for message logging. It allows software to generating messages with a standard format and store the messages as log files on a local disk or shared storage for analyzing and troubleshooting. Syslog has two standard components: Syslog client is a software agent for collecting the software messages and store those messages as log file or send it to a remote server. Syslog server is a remote server to receiving messages from remote clients and store messages on a storage as log file or log database. What’s VMware Syslog Collector? VMware Syslog Collector is Syslog server which provided by VMware as one of vSphere component. Syslog Collector will be installed as stand-alone server or integrated with vCenter server. So when you purchased vSphere product, you have a Syslog server that fully compatible with ESXi, so there is no need to deploy another third-party Syslog server. Configure Syslog via PowerCLI Typically, Syslog will configure on ESXi via vSphere Client and vSphere Web Client but when you have more than one ESXi, configuring Syslog on ESXi is difficult. So you can configure Syslog via PowerCLI. It allows you to configure Syslog on all ESXi servers by run...

PowerCLI 2

[Script]: Find ESXi HBA WWN via PowerCLI

You know, PowerCLI is one of vSphere scripting and automation tools and most of administrators using it for automation and doing their job faster than working with GUI. Finding ESXi host information and exporting those information is very simple and fast via PowerCLI. I want to show you, finding ESXi HBA WWN by PowerCLI in this post. The script is so simple, if you want to find HBA information about specific ESXi host, you can customize that. The below script can help you to find WWN addresses for all your ESXi hosts in a cluster: Get-Cluster | Get-VMhost | Get-VMHostHBA -Type FibreChannel | Select VMHost,Device,@{N=”WWN”;E={“{0:X}” -f $_.PortWorldWideName}} | Sort VMhost,Device To find WWN addresses of a specific host, change the script same as the below: Get-VMhost -Name {ESXi Host Name}| Get-VMHostHBA -Type FibreChannel | Select VMHost,Device,@{N=”WWN”;E={“{0:X}” -f $_.PortWorldWideName}} | Sort VMhost,Device