Skip to content

Instantly share code, notes, and snippets.

#Variable declaration
$vCenterIPorFQDN="192.168.243.172"
$vCenterUsername="[email protected]"
$vCenterPassword="vmware"
$OutputFile="C:\Inetpub\wwwroot\mywebsite\feed.xml" #Where you want to place generated report
Remove-Item $OutputFile #Delete files from previous runs
Write-Host "Connecting to vCenter" -foregroundcolor "magenta"
#Variable declaration
$hosts=@("192.168.243.144","10.0.1.62") #ESXi hosts to download support bundles from
$username="root" #ESXi host username
$password="vmware" #ESXi host password
$destination = "C:\Users\Paolo\Desktop" #Location where to download support bundles
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} #Ignore SSL certificate validation
foreach ($element in $hosts){
#Variable declaration
$vCenterIPorFQDN="192.168.243.172"
$vCenterUsername="[email protected]"
$vCenterPassword="vmware"
$destination = "C:\Users\Paolo\Desktop" #Location where to download support bundles
Write-Host "Connecting to vCenter" -foregroundcolor "magenta"
Connect-VIServer -Server $vCenterIPorFQDN -User $vCenterUsername -Password $vCenterPassword
$hosts = Get-VMHost #Retrieve all hosts from vCenter
Function Backup-VMHost {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string[]]$VMHost,
[Parameter(Mandatory=$True)]
[string]$FilePath
)
#Variable declaration
$vCloudIPorFQDN="192.168.243.50"
$vCloudUsername="User1"
$vCloudPassword="mypassword"
$vCloudOrganization="HostileCoding"
$outputFile="C:\Users\Paolo\Desktop\mobilereport.html"
#Connecting to vCloud
Connect-CIServer -Server $vCloudIPorFQDN -User $vCloudUsername -Password $vCloudPassword -Org $vCloudOrganization
#Variable declaration
$vCenterIPorFQDN="192.168.243.172"
$vCenterUsername="[email protected]"
$vCenterPassword="vmware"
$pathToVcloudAgent="/opt/vmware/vcloud-director/agent" #Path of vCloud Agent in vCloud Director virtual machine
$FileVcloudAgent="vcloudagent-esx51-5.1.0-799577.zip" #vCloud Agent file that will be installed
$downloadDestination="C:\Users\Paolo\Desktop" #Where to download vCloud Agent on local machine
$vCdVmName="vCloud Director" #Name of vCloud Director virtual machine
$vCdVmUsername="root" #vCloud Director virtual machine username
$vCdVmPassword="vmware" #vCloud Director virtual machine password
<?php
$variable1=$_POST["sendpowercli"];
//Post Data
if ($variable1 != null){
$command = $variable1;
$powercli = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -psc \"C:\\Program Files (x86)\\VMware\\Infrastructure\\vSphere PowerCLI\\vim.psc1\" -Command \"& {$command}\"";
$query = shell_exec("$powercli");
#Variable declaration
$vCenterIPorFQDN="192.168.243.40"
$vCenterPort="443"
$vCenterUsername="[email protected]"
$vCenterPassword="vmware"
$DatacenterFolder="DCFolder"
$DatacenterName="Datacenter"
$MgmtClusterName="MgmtCluster"
$OpenStackClusterNames=@("OpenStackCluster") #Cluster(s) managed by OpenStack
$MgmtHosts= @("192.168.243.144") #IP or FQDN of hosts participating in Management Cluster
#Variable declaration
$vCenterIPorFQDN="10.0.1.210"
$vCenterUsername="[email protected]"
$vCenterPassword="vmware"
$ClusterName="My Cluster" #Name of the cluster from which you want to retrieve VM infos
#Location where you want to place generated JSON Files.
#Please be aware that you should place them in the "data" folder in order to make WebPowerCLI read data from them
$OutputPath="C:\Users\Paolo\Desktop\data"
Write-Host "Depending on how many VMs you have in your cluster this script could take a while...please be patient" -foregroundcolor "magenta"
#Variable declaration
$vCenterIPorFQDN="10.0.1.210"
$vCenterUsername="[email protected]"
$vCenterPassword="vmware"
$OutputFile="C:\Users\Paolo\Desktop\Report.html" #Where you want to place generated report
Write-Host "Connecting to vCenter" -foregroundcolor "magenta"
Connect-VIServer -Server $vCenterIPorFQDN -User $vCenterUsername -Password $vCenterPassword
#A JavaScript to add some style to our report