Skip to content

Instantly share code, notes, and snippets.

#User varables
$LIhost = "10.10.10.10" #IP or FQDN
$Provider = "Local" #Local, ActiveDirectory
$Username = "admin"
$Password = "VMware1!"
#SSL certificate trust - Trust all certs
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
#!/bin/bash
#Source https://michaelryom.dk/custom-ddns-on-ubiquiti-usg/
cat << 'EOF' > /etc/cron.hourly/ddns
#!/bin/bash
IP=$(curl -s -L "http://ipv4.myip.dk/api/info/IPv4Address" | sed -e 's/^"//' -e 's/"$//')
curl -s -L "https://api.unoeuro.com/ddns.php?apikey=<API key>&domain=<Domain>&hostname=<Sub domain>&myip=$IP" | logger
EOF
chmod +x /etc/cron.hourly/ddns
#Created by Michael Ryom
#Version 0.1
#2017
#Source: https://michaelryom.dk/export-settings-from-vrops/
#Variables
$username = "user"
$password = "password"
$vRopsFQDN = "vrops.MichaelRyom.dk"
$PageSize = "5000" #Maximum is 5000
$VMHosts = Get-Cluster "Test01" | Get-VMHost
[INT]$Time = "86400" #24 Hours
$Report = @()
#Start running through all hosts in the vCenter
foreach($VMhost in $VMHosts){
#$Resp is used to get responed from try/catch command for getting vlan stats status
$Resp = ""
#Test if vmnic0 is enabled for vlan stats – if true it presumed that all vmnic’s on the host is enabled
try { ($esxcli = $VMHost | Get-EsxCli).network.nic.vlan.stats.get("vmnic0")| Out-Null } catch { $Resp = $_.Exception }