In a blueprint there's a setting that determines how long a VM will live as an expired VM before it's fully decommissioned. Since we're using ASD now we're using a few master blueprints for everything and all of the customization is happening in the vRO. I haven't been able to figure out a way to overwrite that value on a per VM level. Ideally I'd like to change that time to destroy setting to something much shorter for TST and Sandbox VMs. Has anyone looked at this before? Thanks for any info,
Setting Destroyed Date
HPE Smart Array P440ar vSAN driver
Hi,
is there anybody who has HP DL360/DL380 with P440ar and vSAN 6.1?
I have install custom HPE ISO 6.0 U1 (build 307316) and there is hpsa driver version 6.0.0.144-1 BUT on vSAN compatibility matrix is driver hpsa.5.5.0.106-1. vSAN healthcheck shows warning aganist HCL but it works fine.
thank you for your replies.
Joseph Zach
NFS vmk and ISCSI vmk On Same vSwitch
Currently I have one Standard vSwitch with one vmk for NFS storage for my datastores. The vmk is using two vmnic physical adapters which are configured in an etherchannel across two Cisco switches in a stack and the vSwitch teaming and failover is configured to load balance the route based on IP hash and both adapters are active. The vmk is assigned to my NFS VLAN ID. All is operating in a two host cluster.
All of my physical adapters are populated and I need to add ISCSI for SAN storage to compliment the existing NAS storage.
My questions are:
1) Can I add a second vmk to the vSwitch mentioned above and IP it and assign it to an ISCSI VLAN ID?
2) Should I run NFS and ISCSI on different VLANs, but utilizing the same two physical adapters that I am already using for NFS storage for my current datastores?
3) From my research it looks like for Load Balancing/Failover NFS and ISCSI should be configured differently. ISCSI more of an active/passive configuration where the vSwitch setting are being overwritten and forcing one vmnic to be active and a secondary to be passive, even to the point of using two separate vmks for ISCSI.
Any insight anyone could pass along would be greatly appreciated.
Thank you
Getting dependencies on an ESXi host
Bare with me as I'm new to this stuff.
I do have a quite a bit of programming experience and can learn quickly, but I am just new-ish to VMware, its ecosystem, terminology, etc.
We have an idea for an ESXCLI plugin/namespace, but it's going to require a dependency on a specific python library.
This python library in turn has some OS-level dependencies like OpenSSL and SWIG.
I know that ESXi will wipe anything on it's filesystem not in /scratch or not installed from a .vib.
So I'm guessing we're going to have to create a .vib to get these dependencies on the host.
ESXi comes with openssl, but not swig (i believe), and I even think its python installation has been altered by VMware and possibly missing some standard library modules.
My question is, how do I go about getting these missing dependencies on the host? I imagine I have to get any missing build tools on the host too, so that the missing dependencies can get compiled for ESXi.
As you can tell I am pretty lost getting started on all of this.
Any help would be greatly appreciated!
Version Compatibility of SDK and vSphere
Hi there,
I am planning to develop a vcenter plugin that is hopefully able to support as many vSphere versions as possible. So far, I know that using the web client SDK, I should be able to support vSphere-5.1,5.5 and 6.0.
But on the other hand, each vSphere version has its matching SDK version. If my objective is to share as much code as possible and support all 3 vSphere versions (5.1, 5.5 and 6.0), what is my best strategy?
Assuming vSphere is backward compatible, can I assume a plugin developed using the SDK-5.1 is able to run smoothly on vSphere-5.5 and 6.0? Or should I best start at the SDK-6.0 instead?
I am not sure there would be a positive answer to either of my question above. I have a feeling that I probably have to write some version specific code for each of the version that I support. But the kind of functionalities I am trying to achieve is mostly focused on server extension instead of UI and I don't think they are that different from 5.1 to 6.0. I hope I can find a way to share most if not all of my code across the different versions. Is there any best practice or advice for doing this?
Thank you very much,
Shi
Running plugin code within Virgo instead of remotely through yavijava - need help on how to call the APIs
POWERCLI Script Resize VMFS Datastore
Hi,
I have a problem when expanding datastores in 5.0.U1, U2, U3 versions. When large disk cabin, ESXi recognizes the new size, but in "Properties" Datastorage the button "Increase" this is disabled:
I have opened a case with vmware and was told that is a workaround for versions 5.0.X and 5.1.x and in the 5.5.x version is corrected. He sent me this link: VMware KB: Cannot grow VMFS datastore, the Increase button is disabled but I can not apply because it involves service stop.
I found this KB VMware KB: Growing or expanding a VMFS volume or datastore and following the steps sometimes allows me to do the expansion, I enable the "Increase", but many times the button not working, continues disabled.
I found thisl post "Scripted resize of VMFS datastores" but the script fails me, I can not make it work.
The script is this:
$ds = Get-Datastore -Name "Volume05" $dsscsi = get-datastore $ds | get-scsilun $dscanonical = $dsscsi.CanonicalName $esx = Get-View $ds.ExtensionData.Host[0].Key $storSys = Get-View $esx.ConfigManager.StorageSystem $dsSys = Get-View $esx.ConfigManager.DatastoreSystem $vmfsPath = $ds.ExtensionData.Host[0].MountInfo.Path $storSys.RescanAllHba() $extent = $dsSys.QueryVmfsDatastoreExpandOptions($ds.ExtensionData.MoRef) $spec = New-Object VMware.Vim.HostScsiDiskPartition $spec.diskName = $dscanonical $spec.partition = "1" if($extent.Count -ne 0){ $storsys.ExpandVmfsExtent($vmfspath,$spec) }
The error I get is:
Excepción al llamar a "ExpandVmfsExtent" con los argumentos "2": "A specified parameter was not correct. " En E:\Resize_VMFS_01.ps1: 15 Carácter: 3 + $storsys.ExpandVmfsExtent($vmfspath,$spec) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : VimException
Please can someone help me?
Regards
Daniel
vSphere API - Performance Monitoring Question - PerformanceManager or QuickStats
I'm building a script to query the vSphere API for various critical performance metrics for CPU, MEM, Network and Disk performance metrics from vCenter.
I'll then use this data to set various thresholds to generate alerts and also graph performance.
My question is - should I query the API using the PerformanceManager methods or simply grab the "quick stats" data objects?
Here is what I found in this vSphere documentation: vSphere Documentation Center
"You can obtain near real-time summary information about performance or utilization without using the PerformanceManager methods. vSphere servers maintain “quick stats” data objects for hosts (HostListSummaryQuickStats), virtual machines (VirtualMachineQuickStats), and resource pools (ResourcePoolQuickStats). For more information about these objects, see the vSphere API Reference."
It seems that the PerformanceManager method provides far more "Performance Providers" than the "quick stats" as summarized below:
PerformanceManager >> Performance Providers:
Cluster Services
CPU
Management Agent
Memory
Network
Resource Scheduler
Storage Capacity:
Datastore / Virtual Machine
Storage I/O:
Datastore
Disk
Virtual Disk
Storage Adapter
Storage Path
System
Virtual Machine Operations
Quick Stats
Hosts
VMs
Resource Pools
Anyone grappled with this question before?
Thank you!
Amir
Simple vRO workflow to change AD description not working in multiple domain scenario
Hi,
Running vRA v6.2.3 and vRO v6.03. The AD plugin (v2.03) is configured with three Active Directory in the same forest, for example corp.local, dev.corp.local and pre.corp.local. All three are registered with the AD plugin and can be browsed from vRO AD Plugin.
I have an 'AD description' vRO workflow which updates the virtual machines description in AD. This works fine for corp.local but when attempted with systems from the other domains it fails with a 'TypeError: Cannot call method "getAttribute" of null'
The relevant IN parameters are the description, the computers AD description vCACVm (vCAC:VirtualMachine) and computerAD (AD:ComputerAD).
The code as follows...
computerAD=ActiveDirectory.getComputerAD(vCACVm.virtualMachineName);
System.log("Old computer account description is :"+computerAD.getAttribute("description"));
System.log("Setting new description as :"+description);
computerAD.setAttribute("description",description);
I can't figure out what I'm missing?
Cheers
vSphere API - Performance Monitoring Question - Should I use PerformanceManager or QuickStats to query the API?
I'm building a script to query the vSphere API for various critical performance metrics for CPU, MEM, Network and Disk performance metrics from vCenter.
I'll then use this data to set various thresholds to generate alerts and also graph performance.
My question is - should I query the API using the PerformanceManager methods or simply grab the "quick stats" data objects?
Here is what I found in this vSphere documentation: vSphere Documentation Center
"You can obtain near real-time summary information about performance or utilization without using the PerformanceManager methods. vSphere servers maintain “quick stats” data objects for hosts (HostListSummaryQuickStats), virtual machines (VirtualMachineQuickStats), and resource pools (ResourcePoolQuickStats). For more information about these objects, see the vSphere API Reference."
It seems that the PerformanceManager method provides far more "Performance Providers" than the "quick stats" as summarized below:
PerformanceManager >> Performance Providers:
Cluster Services
CPU
Management Agent
Memory
Network
Resource Scheduler
Storage Capacity:
Datastore / Virtual Machine
Storage I/O:
Datastore
Disk
Virtual Disk
Storage Adapter
Storage Path
System
Virtual Machine Operations
Quick Stats
Hosts
VMs
Resource Pools
Anyone grappled with this question before?
Thank you!
Amir
HP VMware ESXi 5.1 update 3 upgrade kills Emulex network and cannot be rolled back ?
People,
I'm having some serious issue here after upgrading the HP Blade BL 465c G7 with Emulex NC551i Dual Port FlexFabric 10 Gb adapter.
The problem: After successful inline update from ESXi 5.1 Update 2 Patch 5 (2000251) into ESXi 5.1 Update 3 (2323236) the ESXi server cannot be pinged nor it can ping to outside network, therefore it failed to reconnect back to VCenter server.
Software/Firmware version:
Before the upgrade of the server the version are as follows:
~ # ethtool -i vmnic0
driver: be2net
version: 10.2.293.0
firmware-version: 4.9.416.2
bus-info: 0000:04:00.0
~ #
Since the version above doesn't work, I've managed to download VMW-ESX-5.1.0-be2net-10.2.477.20-offline_bundle-2541837.zip to upgrade the VMNic driver it into: 10.2.477.20 but still after the update and reboot the network is not ping-able.
Rollback:
I have also tried to perform rollback to the previous working ESXi server version 2000251 using Shift+R but the ESXi server still rebooting as 2323236 with no working network still.
Any other suggestion would be greatly appreciated without having to reconfigure the ESXi settings and Distributed Switch configuration from scratch.
Transferring PCIe Card from Old Physical Machine to New One - Will It Be Accessible by Image of Old Machine?
Hi folks,
Sorry if this is a newbie question, but...
I have a 32-bit PC running XP, and I just bought a 64-bit PC running Windows 10. The XP box contains a PCIe audio interface card, and I plan to remove that card from the old PC and insert it into the new PC.
Before removing the card, though, I'm going to create an image of the XP system (using vCenter Standalone 5.5), which I'll then run in Workstation Player as a guest on the new machine.
So here's my question: Will Workstation Player automatically associate the physical PCIe card in the new machine with the virtual PCIe card in the VM?
Thank you,
T.
Office 2016
Any word on when Mirage will support Office 2016?
Least used datastore workflow
Has anyone created a workflow to check which datastore has the most available space, and then assign the VM create to that database?
This way its not the round robin vra does out of the box.
cannot import esxi image 5.5 to update manager version 6.0.0
Hi All,
I am trying to upgrade my hosts through update manager from 5.1 to 5.5.Initially i thought to upgrade the host to esxi 6 so I upgraded vcenter server to 6.0 as well as update manager to 6.0. Now when i try to import esxi 5.5 image through update manager it throws an error " the uploaded upgrade package cannot be used with vmware update manager" but when I tried to upload esxi 6 image it goes smoothly. Can anyone throw some light on this issue.
Thankyou,
Bikash Sharma.
Install issue - Client cannot connect
Hi All,
I've been creating a proof of concept environment, I have run through the install guides here:
Install / Configure VMware Horizon FLEX | Virtual Thoughts
VMware Horizon FLEX 1.7 Documentation Center
I have been successfully able to install everything to a point up to being able to add in my VM image and set everything else up, right to wanting to connect via the Horizon FLEX client.
This is doing everything on the one server, AD, etc.
I have this test environment set up in our hosting environment, behind a firewall, which I've set up an external IP to hit it with port forwarding for ports 7443 and 7080.
I am able to connect to the admin web interface via: https://<serverFQDN>:7443/rvm OK and can see everything.
But when I plug this address into my client in the form of: <serverFQDN>:7443 I get "Error: HTTP error 404"
I can see in the IIS logs the following:
2015-12-17 02:29:46 10.0.0.74 POST /broker/xml - 7443 - <myIP> VMware-client 404 0 2 20
So it looks like it's trying to hit /broker/xml and 404-ing, which I can confirm when I plug that into my browser manually.
I've followed the install guides to a tee, so I don't know what's happening, did I miss a NAT on my firewall, I assume it's only ports 7443 and 7080 used, as that's all that's set up in IIS to handle.
I have had a look at the local client debug logs and there are no errors that I can see:
2015-12-17 13:36:24.313+10:00 INFO (24CC) [WinCDK] AddServerDlg::OnOk : [User] Enter Ok.
2015-12-17 13:36:24.317+10:00 INFO (24CC) [WinCDK] AddServerDlg::OnOk : [User] Exit Ok.
2015-12-17 13:36:24.318+10:00 INFO (24CC) [WinCDK] Services::LogOffServer : [User] Enter Services::LogOffServer.
2015-12-17 13:36:24.320+10:00 INFO (24CC) [WinCDK] Services::LogOffServer : [User] Exit Services::LogOffServer.
2015-12-17 13:36:24.321+10:00 INFO (24CC) [WinCDK] AppWindow::EnterWindowState : Valid transition from state 'Disconnected' to state 'Connecting'.
2015-12-17 13:36:24.390+10:00 INFO (24CC) [WinCDK] AppWindow::OnAddServer : [User] Exit AddServer.
2015-12-17 13:36:24.390+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetLaunchItemsTask(TODO) added, group task num:1, total task num:1.
2015-12-17 13:36:24.390+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetUserGlobalPreferencesTask(TODO) added, group task num:2, total task num:2.
2015-12-17 13:36:24.393+10:00 DEBUG (1B4C) [(null)] CDKProxy_GetProxyInternal: Enter WinHttpGetProxyForUrl.
2015-12-17 13:36:24.395+10:00 DEBUG (1B4C) [(null)] CDKProxy_GetProxyInternal: Failed to get WinHTTP proxy info with error 0x00002f94.
2015-12-17 13:36:24.433+10:00 DEBUG (24CC) [(null)] CdkProxy_GetProxyForUrl: Got the proxy and return to main message loop.
2015-12-17 13:36:24.433+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetTunnelConnectionTask(TODO) added, group task num:3, total task num:3.
2015-12-17 13:36:24.433+10:00 INFO (24CC) [libcdk] TaskCombiner: Group Tasks(3):CdkGetLaunchItemsTask(TODO),CdkGetUserGlobalPreferencesTask(TODO),CdkGetTunnelConnectionTask(TODO),
2015-12-17 13:36:24.433+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetConfigurationTask(TODO) added, group task num:1, total task num:4.
2015-12-17 13:36:24.433+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkSetLocaleTask(TODO) added, group task num:2, total task num:5.
2015-12-17 13:36:24.433+10:00 INFO (24CC) [libcdk] TaskCombiner: Group Tasks(2):CdkGetConfigurationTask(TODO),CdkSetLocaleTask(TODO),
2015-12-17 13:36:24.433+10:00 INFO (24CC) [libcdk] TaskCombiner: CreateRequest for CdkSetLocaleTask(REDY).
2015-12-17 13:36:24.442+10:00 INFO (24CC) [libcdk] CdkUtil_SetLocalAddress: local ip address 192.168.0.198 is being picked.
2015-12-17 13:36:24.442+10:00 INFO (24CC) [libcdk] Send request successful: 03927D98
2015-12-17 13:36:24.510+10:00 INFO (24CC) [libcdk] Verify server's certificate for Request 0393A688
2015-12-17 13:36:24.510+10:00 INFO (24CC) [libcdk] Find rpc request 0393A688 from list
2015-12-17 13:36:24.544+10:00 INFO (24CC) [libcdk] Alt name 0 matches wildcard *.myserver.com
2015-12-17 13:36:24.544+10:00 INFO (24CC) [libcdk] Found a valid EKU: TLS Web Server Authentication
2015-12-17 13:36:24.603+10:00 INFO (24CC) [libcdk] CdkRpc_HandleResponsesAsync: Handle Response with rpc call id: 1.
2015-12-17 13:36:24.604+10:00 INFO (24CC) [libcdk] Got a response to request 1.
2015-12-17 13:36:24.604+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetLaunchItemsTask(FAIL) removed, group task num:2, total task num:4.
2015-12-17 13:36:24.604+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetUserGlobalPreferencesTask(FAIL) removed, group task num:1, total task num:3.
2015-12-17 13:36:24.604+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetTunnelConnectionTask(FAIL) removed, group task num:0, total task num:2.
2015-12-17 13:36:24.604+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkGetConfigurationTask(FAIL) removed, group task num:1, total task num:1.
2015-12-17 13:36:24.604+10:00 INFO (24CC) [WinCDK] Services::ErrorCallback : Error(Taskname:CdkSetLocaleTask, domain:52, code:404) Callback: Entry.
2015-12-17 13:36:25.651+10:00 INFO (24CC) [WinCDK] AppWindow::EnterWindowState : Valid transition from state 'Connecting' to state 'Disconnected'.
2015-12-17 13:36:25.657+10:00 INFO (24CC) [WinCDK] Services::ErrorCallback : Error(Taskname:CdkSetLocaleTask, domain:52, code:404) Callback: Exit.
2015-12-17 13:36:25.657+10:00 INFO (24CC) [libcdk] TaskCombiner: CdkSetLocaleTask(FAIL) removed, group task num:0, total task num:0.
2015-12-17 13:36:26.767+10:00 INFO (24CC) [WinCDK] AppWindow::OnClose : [User] Enter AppWindow::CloseWindow.
2015-12-17 13:36:26.783+10:00 INFO (24CC) [WinCDK] NotificationAreaManager::HideIcon : Delete notify icon in the notification area succeed.
2015-12-17 13:36:26.784+10:00 ERROR (24CC) [WinCDK] NotificationAreaManager::ShowBalloon : Pop up balloon failed with error: 1460.
2015-12-17 13:36:26.784+10:00 INFO (24CC) [WinCDK] AppWindow::OnClose : [User] Exit AppWindow::CloseWindow.
2015-12-17 13:36:26.784+10:00 INFO (24CC) [WinCDK] BaseAppWindow::OnClose : [User] Enter BaseAppWindow::CloseWindow.
2015-12-17 13:36:26.784+10:00 INFO (24CC) [WinCDK] BaseAppWindow::OnClose : [User] Exit BaseAppWindow::CloseWindow.
2015-12-17 13:36:26.802+10:00 INFO (24CC) [WinCDK] SmallWindow::OnDestroy : [User] Enter OnDestroy.
2015-12-17 13:36:26.809+10:00 INFO (24CC) [WinCDK] SmallWindow::OnDestroy : [User] Exit OnDestroy.
2015-12-17 13:36:26.810+10:00 INFO (24CC) [WinCDK] Services::AppWindowClosed : User has closed all windows. Exiting the application.
2015-12-17 13:36:26.813+10:00 INFO (24CC) [WinCDK] AppMain::RunMainLoop : Waiting for poll thread 00000608 to exit
2015-12-17 13:36:27.219+10:00 INFO (24CC) [WinCDK] AppMain::RunMainLoop : Poll thread has exited
2015-12-17 13:36:27.221+10:00 INFO (24CC) [WinCDK] Services::LogOffServer : [User] Enter Services::LogOffServer.
2015-12-17 13:36:27.221+10:00 INFO (24CC) [libcdk] Disconnecting from broker https://pfflex.myserver.com:7443/broker/xml
2015-12-17 13:36:27.221+10:00 INFO (24CC) [libcdk] CdkUtil_SetLocalAddress: fd -1 < 0, not retrieving local address.
2015-12-17 13:36:27.224+10:00 INFO (24CC) [WinCDK] Services::LogOffServer : [User] Exit Services::LogOffServer.
2015-12-17 13:36:27.233+10:00 INFO (24CC) [libcdk] Set local language as NULL.
2015-12-17 13:36:27.234+10:00 INFO (24D8) [libcdk] Exit poll thread.
I'm at a loss as to what the issue could be. Has anyone had the same issue?
net.throughput.usage.average
Get-VM *db* |
Select Name, @{N="Avg Network Throughput MBPs";E={
[math]::Round((Get-Stat -Entity $_ -Start (Get-Date).AddDays(-1) -Stat "net.throughput.usage.average" |
where {$_.Instance -eq ""} |
Measure-Object -Property Value -Average | Select -ExpandProperty Average)/1KB,2)
}}
I got the output as below
Name | Avg Network Throughput MBPs |
x | 0 |
y | 2.16 |
z | 0.11 |
now Questions Or Clarifications that are needed :-
1.
net.throughput.usage.average | Net Throughput Usage | KBps | The current network bandwidth usage for the host
|
Why then the o/p shows MBPs & not KBPs
2. So per second in last 1 day the vm did network traffic worth say 2.16 for vm y ? Does this include inbound & outbound both ?
Thanks
Why cant I see Domain Join status of ESXi in vCenter?
Hi all
I treasure your reply.
My ESXi6 was joined Active Directory Domain using vSphere Web Client and its successful. I also checked domain join status in vCenter Server, system configration>node>manage>setting, but I couldnt see domain join status.
Why cant I see Domain Join status of ESXi in vCenter?
@
Help tweaking a script to deploy/recover to a specific datastore cluster rather than just a specific datastore
I butchered a script which was originally created to clone VMs to a specific folder and datastore and remove a time stamp at the end of the VM name. I'm now trying to rework it so it recovers the clones back to a production datastore cluster rather than just a specific datastore. It does literally everything I need it to with one exception, I don't seem to be able to successfully tweak it to recover back to a datastore cluster as opposed to just a specific datastore. Everything I try results in dismal failure I wonder if someone can suggest a tweaked version for me so I can try and understand where I went wrong?
# ==============================================================================================
# NAME: RecoverVMs
#
# AUTHOR: Luke Glazebrook
# DATE : 09/10/2015
#
# COMMENT: Recovers cloned VMs and uses passed param to specify which cycle of VMs to restore,
# and removes the -$CYRPYYMMDD ammendment at the end of the VM name.
#
#
#
# * Software Dependencies: *
# - Microsoft PowerShell *
# - VMWare PowerCLI *
# ==============================================================================================
# Parameters
# ==============================================================================================
# The below parameter supplied by Control-M refers to cycle and recovery point prefix,
# the date can be added automatically however this functionality has been disabled.
# Date stamp supplied parameter e.g VM1-20151212
param ([string]$CYRPYYMMDD)
# ==============================================================================================
# Functions
# ==============================================================================================
#Function to allow you to check if a command is loaded
Function Check-Command($cmdname)
{
return [bool](Get-Command -Name $cmdname -ErrorAction SilentlyContinue)
}
# ==============================================================================================
# Varibles
# ==============================================================================================
# Add the vmware snapin for powershell
# Add-PSSnapin VMware.VimAutomation.Core
# Add the vmware snapin for powershell (stops you seeing the error messages)
if (Check-Command "Connect-VIServer")
{
Write-Host "Automation Tool already loaded"
}
else
{
#If not already loaded load the snapin
Write-Host "Loading Automation Tools"
Add-PSSnapin VMware.VimAutomation.Core
}
# backup = true appends date; false creates a clone with the same name.
$backup = "True"
# debug - true : will not clone vm; FALSE will clone the vm.
$debug = "FALSE"
# Target Datastore
$targetdatastore = "LS-H249-DS1-320GB"
#Refers to the percentage of free space for the DS space check
$freePerc = 5
# Target location - existing folder in vcenter structure, where the clones will be place
$targetlocation = "ProdFolder"
# Set date
$datestart = (get-date -uformat %Y%m%d)
# Name a logfile to capture results.
$logfile = $datestart + "_VMClones_bulk.txt"
#
write-output "New Log ($datestart) - ($logfile)" >> $logfile
# Gets the list of VMs from the file associated with this script
$VmFileList = Get-Content VmsToCloneList.list
#
$ds = Get-Datastore -Name $targetdatastore
#Email varibles
$From = "vCenter@lbase.homeip.net"
$To = "luke@lbase.homeip.net"
$Cc = "luke@lbase.homeip.net"
#$Attachment = "C:\temp\Some random file.txt"
$Subject = "!! TEST DMAT Report TEST !!"
$BodySuccess = "The DMAT VMs have been sucessfully recovered to the specified destination datastore and inventory organisational folder within vSphere"
$BodyFailure1 = "The combined provisioned VMDK usage of the VM's exceeds the capacity of the destination datastore, exiting with code 1"
$BodyFailure2 = "There is insufficient space on the target datastore, increase Space to continue, Exiting with code 2"
$BodyFailure3 = "A VM by the name specified cant be found perhaps it does not exists? Exiting with code 3"
$SMTPServer = "192.168.0.101"
$SMTPPort = "25"
# Establish Connection
Connect-VIServer -Server 127.0.0.1 -User administrator@lbase -Password omega1
# ==============================================================================================
# Deletes current working test VMs in preperation for the recovery of the backup clones
# ==============================================================================================
foreach($vm in $VmFileList){
$active = Get-VM $vm
if($active.PowerState -eq "PoweredOn"){
Stop-VM -VM $vm -Confirm:$false
Start-Sleep -Seconds 10
Remove-VM -VM $vm -DeleteFromDisk -Confirm:$false -RunAsync}
else
{Remove-VM -VM $vm -DeleteFromDisk -Confirm:$false -RunAsync}
}
# ==============================================================================================
# Gets the VM total ProvisionedSpaceGB for all VM's in the list.
# Additionally ensures whitespaces and hashes are ignored effectively
# creating a clean list which calculates/creates the varible required for validation check 1
# ==============================================================================================
$vmCleanedList = New-Object system.Collections.ArrayList
# Loop through our VM file List and clean is up, check for incorrectly specified VM's
ForEach ($vmname in $VmFileList)
{
if ([string]::IsNullOrWhiteSpace($vmname) -or $vmname.StartsWith("#"))
{
write-host("Invalid machine name - $vmname")
}
else
{
#Should trim vmname to ensure we have no spaces front or end
$vm = Get-VM $vmname
$vmCleanedList.Add($vmname)
$TotalRequiredGB += $vm.ProvisionedSpaceGB
}
Write-Host "Total Required = $TotalRequiredGB"
}
# ==============================================================================================
# Validation checks Prior to starting the clone script
# ==============================================================================================
# Validation check 1, Checks if the combined provisioned VMDK usage of the VM's exceeds the capacity of the destination datastore?
if(($ds.FreeSpaceGB -gt $TotalRequiredGB))
{
Write-Host "Continue with your script"
}
else
{
Write-Host "There is insufficient space on the target datastore. Please increase Space to continue"
Write-Output "There is insufficient space on the target datastore. Please increase Space to continue" >> $logfile
Write-Host "Exiting with code 1"
Write-Output "Exiting with code 1" >> $logfile
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
-Body $BodyFailure1 -SmtpServer $SMTPServer -port $SMTPPort
exit 1
}
$ds = Get-Datastore -Name $targetdatastore
# Validation check 2, do you have X % free datatstorespace?
if(($ds.FreeSpaceGB/$ds.CapacityGB*100) -ge $freePerc)
{
Write-Host "Continue with your script"
}
else
{
Write-Host "There is less than X% space free on the datastore. Please increase Space to continue"
Write-Output "There is less than X% space free on the datastore. Please increase Space to continue" >> $logfile
Write-Host "Exiting with code 2"
Write-Output "Exiting with code 2" >> $logfile
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
-Body $BodyFailure2 -SmtpServer $SMTPServer -port $SMTPPort
exit 2
}
#Hack + duplication of effort
#$VmListFile = Get-Content VmsToCloneList.list | Select-Object -Skip 3
ForEach ($vmname in $vmCleanedList)
{
# The VM Object
$RemoveCYRPYYMMDD = $vmname + "-" + $CYRPYYMMDD
$vm = Get-VM -Name $RemoveCYRPYYMMDD
# Target Host - use the same host as the current VM ( this is faster than cloning across hosts ).
$targethost = $vm.vmhost.name
# Target VM Name - name if BACKUP is FALSE
$vmtarget = $vmname
#
$datastore = get-datastore $targetdatastore -vmhost $targethost
# ==============================================================================================
# Begin the actual cloning script
# ==============================================================================================
if ($vm -ne $null)
{
Write-Host "A VM named $VM exists. Starting clone"
Write-output "A VM named $VM exists. Starting clone" >> $logfile
}
else
{
Write-Host "A VM by the name specified cant be found perhaps it does not exists?"
Write-Output "A VM by the name specified cant be found perhaps it does not exists?" >> $logfile
Write-Host "Exiting with code 3"
Write-Output "Exiting with code 3" >> $logfile
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
-Body $BodyFailure3 -SmtpServer $SMTPServer -port $SMTPPort
exit 3
}
if ($backup -eq "TRUE")
{
# Clone the VM to backup_vmname_todaysdate
$vmtarget #= $vmtarget + "-" + $CYRPYYMMDD #+ "-" + $datestart
}
# nice colors if you are watching the script run
write-host -foregroundcolor green "Cloning $vm to $vmtarget"
write-output -foregroundcolor green "Cloning $vm to $vmtarget" >> $logfile
new-vm -name $vmtarget -vm $vm -vmhost $targethost -datastore $datastore -Location $targetlocation -DiskStorageFormat thin
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
-Body $BodySuccess -SmtpServer $SMTPServer -port $SMTPPort
}
Write-Host "Complete"
Exit 0
# COMPLETED
vRealize Automation + NSX Distributed Routers
Hi everyone,
3 questions regarding vRA + NSX integration and distributed routers :
1 - Is there any way to provision a distributed router as part of a multi-machine blueprint in vRA?
2 - It doesn't seem to be possible natively, has anyone developed anything that would do this via a vRO workflow? Via a call to the NSX API?
3 - Is there something I am missing in thinking that I would want to deploy 1 logical router per "application stack"? (1 application stack = 1 multi machine blueprint)
For reference, here are the software versions I'm using :
vRA v6.2
NSX plugin for vRO v1.0.2
NSX v6.2
vCenter 6.0
Thanks!
Marcus