Some helpfull PowerShell functions (working with 60 days trail license)

Categories: ESXi, PowerShell, Scripts, VMware, vSphere


$ServerIP = "YourESXiServerIP"
$SysLog = "YourSyslogServerIP"

Configure Syslog server using Powershell

function syslog {
	$VMHost = Get-VMHost -Name $ServerIP
	Set-VMHostSysLogServer -VMHost $VMHost -SysLogServer $SysLog -SysLogServerPort 514

Configure NTP server and restart NTP service

function set-ntp{
	$vmHost = Get-VMHost -Name $ServerIP
	Add-VMHostNtpServer -VMHost $VMHost -NtpServer YourNTPserver1
	Add-VMHostNtpServer -VMHost $VMHost -NtpServer YourNTPserver1
	Get-VmHostService -VMHost $VMHost |Where-Object {$_.key-eq "ntpd"} |Start-VMHostService

Create a new vSwitch

function create-vSwitch{
        $vmHost = Get-VMHost -Name $ServerIP
        $vmotion = New-VirtualSwitch -VMHost $vmHost -Name vSwitch1 -Nic vmnic4 -NumPorts 1024

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.