Category: Script

Daylight Saving 1

Iran Daylight Saving on March 2023

The government of Iran has announced that daylight savings will not be observed from March 2023. But apparently, this issue has not been properly coordinated with international institutions. So this was cause of many issues on public services in Iran. We did some updates and configuration changes before 22nd March 2022 and I want to share the story with you.

PowerShell 1

BIOS Configuration: Best Solution for HPE G10/G11 Servers by PowerShell

Last post was about configuring HPE smart array and create logical drives on HPE G10 servers by HPE Scripting Tools. This post is about configuring HPE G10 via PowerShell by using HPE BIOS cmdlets. As I have mentioned in the last post, there are also cmdltes available for Smart Array, iLO and OA which helping administrators to configure and deploy servers faster than regular ways and without no additional cost. In order to configure HPE servers by script, you need to download and install HPE Scripting Tools: Scripting Tools for Windows Sample BIOS Script The below script is a sample for configuring HPE DL580 G10: The above script needs same credential on multiple servers if you want to applying configurations on multiple servers at same time. Also don’t run script on server that server has production server, it has been created for first deployment. Replace “iLO IP 1” and others with your servers’ iLO IP addresses. Further Reading Why Device Bay IP Doesn’t Change in HPE BladeSystem? [Script]: Enable/Disable vMotion on VMKernel Ports via PowerCLI Configure NTP on iLO via HPE Scripting Tools How to Create Logical Drive on HPE DL580 G10

PowerShell 1

PowerShell: How to Create Logical Drive on HPE G10

I have published some posts about HPE Scripting Tools for PowerShell to automating physical server preparation and deployment services. The tools helping administrators to deploying services on HPE servers faster than normal ways, also there is no additional costs, just buy a PowerShell book! The scripting tools provides PowerShell cmdlets for configuring BIOS, iLO, OA and Smart Array. The tools are available for download as free tools on HPE website. Scripting Tools for Windows The smart array cmdlets are compatible with HPE Generation 10 and not all smart array adapters. Read the user guide document to find list of compatible smart array adapters. The tools will help to configure smart array adapters on multiple servers very faster than normal ways or other automation tools. Of course, the tools is not comparable with HPE OneView. Sample PowerShell Script to Create Logical Drive with 2 Drive The below sample will create two logical drives from 4 drives on multiple servers: Same administrator account will be required on the servers and you can change “iLO IP” with your iLO IP addresses. Logical drives will be made as RAID 1. The script has been tested on HPE DL580 G10. You need to install HPE...

PowerCLI 0

PowerCLI: Best Way to Run Invoke-VMScript and Challenges with Linux Guest

There is some challenges for passing Linux commands with parameters to guest OS. In most of cases, administrators have to pass commands as a PowerShell variable also I had some bad experiences, as an example: run “Sed” with some special parameters. I have to use lot of double quotes and single quotes to pass command via Invoke-VMScript to guest OS.

PowerShell 3

NTP Configuration in iLO: Best and Fast Solution by PowerShell

In order to keep synchronize iLO time with NTP server or time server, you have to enable NTP configuration and add proper NTP server address. Configuring NTP on more than one server is a difficult task for any administrator, because you have to do it via iLO command line or web based GUI manually. At this post I want to share an example for NTP configuration as a PowerShell script.

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

hv replica job re ip 4

Re-IP Rule on Linux VM: Best Solution in Veeam Backup and Replication 7.x Version and Newer

Veeam Backup & Replication is one of the best backup and replication software that you can use them in your virtual environment. Veeam BR be able to IP customization during disaster-recovery and you can have your virtual machines in a DR site with different IP plan. But Veeam BR just support Windows VMs for IP customization or “Re-IP Rule”. So what can we do about Linux virtual machines and others?