justingrote's Posts

My SR with VMware has been marked as a potential issue and I'm waiting for them to reproduce it in their lab before it gets marked as a bug.
Greetings, I want to know if it is possible to register plugins like the VMWare Data Recovery and Xtravirt RDP plugins with vcenter, so that when someone has downloaded the client from vc... See more...
Greetings, I want to know if it is possible to register plugins like the VMWare Data Recovery and Xtravirt RDP plugins with vcenter, so that when someone has downloaded the client from vcenter, they can just go to the list of available plugins and click "download and install" for these plugins. I'd prefer to do this over giving people the installer files. Is it possible? Obviously Update Manager distributes in this fashion, so I'm assuming others can.
I ran into your same problem and submitted this as Support Request 1534622431. Hopefully I'll get some answers and I'll post here if I do.
@brekus: I have it logging to the event viewer in the newest version written for PowerCLI, I'll get around to posting it one of these days. @swjunke: It's the full virtual machine, so typicall... See more...
@brekus: I have it logging to the event viewer in the newest version written for PowerCLI, I'll get around to posting it one of these days. @swjunke: It's the full virtual machine, so typically for restoration we just use VMWare Converter to import the virtual machine. It could be scripted for restore but Converter would be easier so I'd just say do that.
Bump. We're seeing this too, and we've applied the latest patches available.
Hi bmwatson, This script is pretty much deprecated, as it was meant to solve VirtualCenter integration in Lab Manager 2. Lab Manager 3 added that, so this script is pretty much useless now. ... See more...
Hi bmwatson, This script is pretty much deprecated, as it was meant to solve VirtualCenter integration in Lab Manager 2. Lab Manager 3 added that, so this script is pretty much useless now. However, there are lots of good scripts for identifying snapshots in general in VMWare, and then you could probably add some code to automatically remove them, so I'd definitely look at those.
VMWare Quick Migration Function Author: Justin Grote <jgrote NOSPAMAT enpointe DOT com> Credit: Inspired by Mike DiPetrillo's Quick Migration Script: http://www.mikedipetrillo.com/miked... See more...
VMWare Quick Migration Function Author: Justin Grote <jgrote NOSPAMAT enpointe DOT com> Credit: Inspired by Mike DiPetrillo's Quick Migration Script: http://www.mikedipetrillo.com/mikedvirtualization/2008/10/quick-migration-for-vmware-the-power-of-powershell.html Version: 0.1 Last Revised: 31 July 2009 Description: Performs the fucntional equivalent of a Hyper-V Quick Migration by suspending a VM, moving it to a new host, and resuming it. This does not require vMotion licensing. it works by providing required VM objects via the pipeline or the second argument, and specifying the Destination host in the first argument. The commeand accepts both text strings and VMHost objects for the VMHost Parameter Prerequisites: Powershell v1 VMWare PowerCLI 4.0 (May work with earlier version but not tested) Instructions to Install: Save this script and import into your session with, for example, . C:\temp\quickmigrate.ps1 You can also include it in your PowerCLI profile to have it automatically included. Command Usage: get-vm MyTestVM | Quick-MigrateVM "MyTestHost2"
Update 27-Aug-08: Script updated for VI Toolkit 1.0 and Powershell v2 CTP2 Create Disaster Recovery Hard Drive Motivation This script was created out of a motivation of laziness. Since VM's p... See more...
Update 27-Aug-08: Script updated for VI Toolkit 1.0 and Powershell v2 CTP2 Create Disaster Recovery Hard Drive Motivation This script was created out of a motivation of laziness. Since VM's proliferate so fast, most backup and disaster recovery solutions are a pain in the ass because you have to manually add and remove virtual machines to their backup processes. What if there was a way to automatically add and remove VM's to a backup solution simply because of where they are located in Virtualcenter? What if I had an automated DR solution to removable USB hard drives for my smaller clients that was FREE? Hence this script. This script dynamically backs up all VM's in a particular Virtualcenter folder using VCB, and drops them out to a USB hard drive for disaster recovery purposes. If I don't want a VM backed up anymore, I simply take it out of that folder. Note that this also leverages the new networked method of VCB, so YOU DO NOT NEED A SAN AND DIRECT ACCESS TO THE LUNs. The script is also flexible enough so that if you do have the SAN VCB configuration, you can do LAN-free backups with this method too. Note that the query here is just an example. Any way you can return a list of VM's, you can give it to the backup-vm cmdlet. Some examples that come to mind: Backup all virtual machines with disks under 500MB in size Backup all virtual machines created after July 1st Backup all virtual machines with "Prod" in their names Backup all virtual machines with a custom attribute defined called "BackMeUp" set to true Backup all virtual machines currently residing on a particular host, cluster, or datacenter. This script took me about 8 hours, mostly because I was learning how to do script cmdlets and dealing with all the incompatabilities/breakage of CTP Powershell releases as well. Script Cmdlets The task evolved into my first foray into the new Script Cmdlets in Powershell v2. They're so easy to make I went wild and wrote a near-complete wrapper to VCB. Cut and paste the "cmdlet" section out of the code and put it in your profile, and you can now use the Backup-VM cmdlet. Usage Install onto a server or workstation with the prerequisites defined in the script (VCB, Powershell v2 CTP2, VI Toolkit v1.0) Edit the parameters of the script to suit your environment. BE VERY CAREFUL WITH VMBackupDestination Run to test, then set up as a scheduled task on a daily interval. Example Screenshot: VCB Backup Script in Action Script Due to issues with VMWare Communities, the script is now attached to this document.
Ah, thanks, I guess I should GTFA (Google the Freakin' Answer) next time. I was hoping for a cleaner solution, like using the object returned from get-vc into get-view to access some kind... See more...
Ah, thanks, I guess I should GTFA (Google the Freakin' Answer) next time. I was hoping for a cleaner solution, like using the object returned from get-vc into get-view to access some kind of managed object who's connection I could track. Feature request? Anyhow, in the meantime I just decided that for the purposes of this script, I'll just gather all the objects I need up-front so that a second connection doesn't have to be made. Thanks!
Greetings, How can I check to see if the Powershell Connection to my servers is still up? I'm writing a script that uses VCB to back up a list of virtual machines, and it is working great,... See more...
Greetings, How can I check to see if the Powershell Connection to my servers is still up? I'm writing a script that uses VCB to back up a list of virtual machines, and it is working great, however a problem I am running into is that after some VM's that take a LONG time to back up, when it is ready to process the next host, the VI connection has timed out. Easy fix to this was to just do a connect-viserver before each backup, but that is a lot of unnecessary overhead and I'd rather just check if the connection is up and then reconnect it only if it isn't available. I know this is possible because the toolkit itself does it if you try to do a command and the connection isn't up. What object do I have to expose through the SDK to track this? Thanks, -Justin Grote
Found this thread in a google and found it helpful, thought I'd pass some additoinal info along: The channel stuff mentioned above conflicts with HPRSM. No problem though, because you can ... See more...
Found this thread in a google and found it helpful, thought I'd pass some additoinal info along: The channel stuff mentioned above conflicts with HPRSM. No problem though, because you can just install hponcfg like this: rpm -ivh --nodeps hponcfg-1.7.0-2.noarch.rpm And it will ignore the dependency checking. hponcfg just installs the single binary, and it works just fine with those APIs. That's all I had to do to get my tool working and set up iLO on a server 100 miles away
Nope, please feel free, I wouldn't have put it out here if I didn't want people to redistribute it
Motivation In the official documentation they say that you shouldn't use Lab Manager and Virtualcenter to manage the same ESX Hosts. Since I don't have the luxury of investing in dedicated ESX ... See more...
Motivation In the official documentation they say that you shouldn't use Lab Manager and Virtualcenter to manage the same ESX Hosts. Since I don't have the luxury of investing in dedicated ESX Servers for my lab, I decided to write a script that automatically moves Lab Manager-created VM's into a specific folder and resource pool, and automatically removes undeployed Lab Manager VM's from the inventory. This keeps my VirtualCenter organized and puts the Lab Machines in low-end resource pools so that my production VM's still get their reserves and SLA shares. Requirements Powershell VI Toolkit for Windows A VirtualCenter user with rights to browse through VirtualCenter and Move VM's Access to the SSL port of your Virtualcenter server from the host you run the script (i.e. not firewalled). Usage First, edit the script and change the constants so that they match your environment: Lab Manager Resource Pool - Which resource pool you want your Lab Manager VMs to reside (ex. "MyLab") Lab Manager Folder - Same as above but a folder under Virtual Machines and Templates Virtualcenter Server - Your VC Server. Note that the name here must match the name on your virtualcenter SSL certificate. VC Username - The user to connect to VirtualCenter as. I recommend a service account but you can use "administrator" if you want. VC Password - Password for the user. Yes, I know it is in cleartext in the script, but since it's on my VC server using a low-privilege service account and I apply strict permissions to the files there, I'm not worried. If this bothers you, look up the SecureCredentials stuff in powershell. I set up this to run as a scheduled task on my VirtualCenter server every 5 minutes, but it can run anywhere that has the VI Toolkit and access to the VirtualCenter SSL port. I recommend creating a service account to run the script periodically under, because it looks cool in your Virtualcenter when a bunch of cleanup tasks owned by "LabManagerCleanup" come up every 5 minutes. Huge thanks to the VI Toolkit team! The meat of the script is probably only about 10-15 lines and makes some direct VMWare SDK accesses that the base cmdlets don't do, I've just added a ton of comments and colored output fluff. Powershell saved me so much time, I banged this out in a couple hours. Hope this helps anyone else out there! I know there's some kludgy logic in this script and I note it, but I'm a consultant/admin, not a programmer, and it works just fine. Feel free to make it better! NOTE: The below may not format well in some versions of IE7. View it in Firefox and it should be line-carriaged properly. # TITLE: Lab Manager Cleanup Script # AUTHOR: Justin Grote <jgrote*NO*@!SPAM!enpointe.|PLEASE|com> # PURPOSE: Cleans up undeployed Lab Manager VM's, and puts deployed Lab Manager VM's # into specific resource pools and folders # USAGE: Edit Constants to match your environment, run once manually to test, then schedule as repeating task. #Load the VI Toolkit for Powershell add-pssnapin VMWare.VimAutomation.Core ## CONSTANTS #Virtualcenter Server Name $VCNAME = "virtualcenter.yourcompany.com" #VirtualCenter Service Account #NOTE: Highly recommended this be a separate service account such as "VMLabMgrSA" so it is easy # to see in Virtualcenter when the script is moving things about. $VCUSER = "username" $VCPASSWORD = "yourpassword" #Desired Lab Resource Pool Name $LABMGRPOOLNAME = "MyLabManagerResourcePool" #Desired Virtualcenter Folder $LABMGRFOLDERNAME = "MyLabManagerFolder" #Creates an indentation for subtasks. Used for script output formatting $INDENT = " " ### SCRIPT write-host -fore green "== BEGIN LAB MANAGER CLEANUP ==" #Connect to Virtualcenter $vc = get-viserver $VCNAME -user $VCUSER -password $VCPASSWORD #Lab Manager Resource Pool $LabMgrPool = get-resourcepool $LABMGRPOOLNAME #Lab Manager Virtualcenter Folder $LabMgrFolder = get-folder $LABMGRFOLDERNAME #Discover all Lab Manager VM's. #Note this is done really sloppily by looking for all VM's that have a .vmx file in a #specific datastore folder that Lab Manager manages. #A Better way would be to query some sort of Lab Manager API. $LabMgrVMs = get-vm | where {(get-view $_.ID).summary.config.vmpathname -like "*] VM/*"} ## TASK 1: Move All Virtual Machines to the designated Lab Manager Folder and Resource Pool write-host -fore green "Moving Lab Manager Virtual Machines to their desired locations..." foreach ($LabMgrVM in $LabMgrVMs) { #Verify that the VM is not already in the desired folder and move it. if (-not ($(get-vm -location $LabMgrFolder | foreach{$_.get_ID() }) -contains $LabMgrVM.get_ID() )) { write-host -fore Yellow $INDENT "Moving" $LabMgrVM.Name "to folder" $LabMgrFolder.Name move-VM $LabMgrVM -Location $LabMgrFolder | out-null } else { write-host $INDENT $LabMgrVM.Name "is already in folder" $LabMgrFolder.Name } #Verify that the VM is not already in the desired resource pool and move it. if (-not ($(get-vm -location $LabMgrPool | foreach{$_.get_ID() }) -contains $LabMgrVM.get_ID() )) { write-host -fore Yellow $INDENT "Moving" $LabMgrVM.Name "to resource pool" $LabMgrPool.Name move-VM $LabMgrVM -Location $LabMgrPool | out-null } else { write-host $INDENT $LabMgrVM.Name "is already in resource pool" $LabMgrPool.Name } } ## TASK 2: Clean up all undeployed Lab Manager VMs. write-host -fore green "Cleaning up all undeployed Lab Manager VMs" #Get all Lab Manager VM's listed in the defined Lab Manager folder. #I do this instead of getting *ALL* VM's because there may be some orphaned VMs that #Aren't from Lab Manager that we may not want to touch #Again, this is sloppy, and should use some sort of Lab Manager API $LabMgrRegisteredVMs = get-vm -location $LabMgrFolder #Check if any Lab Manager VM's are orphaned, and remove them from the inventory. foreach ($LabMgrVM in $LabMgrRegisteredVMs) { if ((get-view $LabMgrVM.get_ID() ).runtime.ConnectionState -like "orphaned") { write-host $INDENT "Removing orphaned VM" $LabMgrVM.Name "from inventory." remove-VM $LabMgrVM -confirm:$false | out-null } } write-host -fore green "== END LAB MANAGER CLEANUP ==" ### END SCRIPT - Justin Grote Senior Systems Engineer En Pointe Technologies