This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Get Guest OS Credential | |
$Credential=Get-Credential | |
#Get VM Names (As Name Template) - Example Test-2* | |
$VM=Read-Host "Please Enter The VMs Template Name" | |
#Get IP Address Range - Example 10.1.1 or 192.168 - This IP Range Will Be Used For Replacing | |
$NIPAddress=Read-Host "Please Enter New IP Range" | |
$OIPAddress=Read-Host "Please Enter Current IP Range" | |
#Replace New IP Range With Old IP Range | |
Get-VM "$VM" | Invoke-VMScript -ScriptText 'sed -ri "s|$NIPAddress|$OIPAddress|" /etc/sysconfig/network-scripts/ifcfg-eth0 && cat /etc/sysconfig/network-scripts/ifcfg-eth0' -GuestCredential $credential | |
Get-VM "$VM" | Invoke-VMScript -ScriptText 'sed -ri "s|$NIPAddress|$OIPAddress|" /etc/fstab && cat /etc/fstab' -GuestCredential $credential |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Connect to ESXi hosts via root account | |
$VMHosts="ESXi1 IP/DNS Name","ESXi2 IP/DNS Name",....,"ESXiN IP/DNS Name" | |
$Accounts="User1","User2",....,"UserN" | |
Foreach ($VMHost In $VMHosts) | |
{ | |
Connect-VIServer -Protocol https -Server $VMHost -User root -Password QWERTY | |
Foreach ($Account In $Accounts) | |
{ | |
#Create User with Shell Access | |
Write-Host "Create User For $Account" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Script=@' | |
rm -rf /customizing.sh | |
touch /customizing.sh | |
echo "#!/bin/bash" >> /customizing.sh | |
echo "sed -i '1d' /etc/resolv.conf" >> /customizing.sh | |
echo "sed -i '3d' /etc/hosts" >> /customizing.sh | |
echo "sed -i '12d' /etc/sysconfig/network-scripts/ifcfg-eth0" >> /customizing.sh | |
echo "sed -i '13d' /etc/sysconfig/network-scripts/ifcfg-eth0" >> /customizing.sh | |
echo "sed -i '14d' /etc/sysconfig/network-scripts/ifcfg-eth0" >> /customizing.sh | |
echo "sed -i '15d' /etc/sysconfig/network-scripts/ifcfg-eth0" >> /customizing.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Servers="iLO1 IP","iLO2 IP","iLO..N IP" | |
$Credential=Get-Credential | |
ForEach ($Server in $Servers) | |
{ | |
Set-HPiLOIPv6NetworkSetting -Server $Server -Credential $Credential -DHCPv6SNTPSetting N -DisableCertificateAuthentication | |
Set-HPiLONetworkSetting -Server $Server -Credential $Credential -Timezone "Etc/UTC" -SNTPServer1 "NTP Server Address" -DHCPSNTP N -DisableCertificateAuthentication | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################################################### | |
##Script: Get-VMToolsTimeSync ## | |
##Description: Get VMware Tools Time Synce Status ## | |
##Created by: Davoud Teimouri ## | |
##Creation Date: March 27, 2018 ## | |
##################################################################################################### | |
#Create output table | |
$TableName="TimeSync" | |
$Table = New-Object system.Data.DataTable “$TableName” |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ConvertFrom-SecureToPlain { | |
param( [Parameter(Mandatory=$true)][System.Security.SecureString] $SecurePassword) | |
# Create a "password pointer" | |
$PasswordPointer = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword) | |
# Get the plain text version of the password | |
$PlainTextPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto($PasswordPointer) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The script will be worked on RHEL/Fedora/CentOS. | |
# Set logging options | |
# Variables. | |
primary_gw="192.168.100.254" | |
replica_gw="192.168.200.254" | |
primary_ipaddr="192.168.100.10" | |
replica_ipaddr="192.168.200.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The script will be worked on RHEL/Fedora/CentOS. | |
# Set logging options | |
# Variables. | |
primary_gw="192.168.100.254" | |
replica_gw="192.168.200.254" | |
primary_ipaddr="192.168.100.0" | |
replica_ipaddr="192.168.200.10" | |
primary_netmask="24" | |
replica_netmask="24" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#====================================================================# | |
# SCRIPT: CPU_Ready_Alarm.ps1 # | |
# FUNCTION: Detect, analyaze CPU ready alarms and migrate # | |
# problomatic VMs to another host # | |
# CREATED: 30/01/2015 # | |
# MODIFIED: 10/08/2015 # | |
# OWNER: Davoud Teimoru / Teimouri.net # | |
# VERSION: v.1.1 # | |
#====================================================================# | |
# CHANGELOG: # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Version 1.0 | |
'Written by Davoud Teimouri | |
Option Explicit | |
On Error Resume Next | |
Dim strComputer | |
Dim strUser | |
Dim objGroup | |
Dim ObjUser | |
strComputer = Inputbox ("Please enter the computer name (Without domain name):") | |
strUser= Inputbox ("Please enter the user name:") |
OlderNewer