Advertisement

news | articles | utilities | resources | about

News

Import / Export Custom Attributes

In a posting that I had a few days ago on how to export permissions and DRS affinity rules, one reader wrote and asked me if the same could be done for custom attributes. As it turns out, you can in just a few lines of powershell. You can export the attributes by selecting the virtual machines tab and deselecting all but the attributes that you want to export and then just select file->export. Choose a format of .csv. Then to import those values we'll use that same export file and use a few lines of powershell to import those values. So assuming we name our attributes "Business Line" and "Maintenance Window" the import would look like the following:


foreach ($vm in (import-csv "export.csv")){
$myvm = get-vm $vm.Name
set-customfield -entity $myvm -name "Business Line" -value $vm."Business Line"
set-customfield -entity $myvm -name "Maintenance Window" -value $vm."Maintenance Window"
}


If you have your system inventory information in a separate database, this could be very useful to keep your vCenter up to date with your current system inventory.

Posted by Dominic Rivera at Wednesday, June 17, 2009.


Archives

10/01/2006 - 11/01/2006 | 03/01/2007 - 04/01/2007 | 04/01/2007 - 05/01/2007 | 05/01/2007 - 06/01/2007 | 06/01/2007 - 07/01/2007 | 07/01/2007 - 08/01/2007 | 09/01/2007 - 10/01/2007 | 10/01/2007 - 11/01/2007 | 11/01/2007 - 12/01/2007 | 12/01/2007 - 01/01/2008 | 01/01/2008 - 02/01/2008 | 02/01/2008 - 03/01/2008 | 03/01/2008 - 04/01/2008 | 04/01/2008 - 05/01/2008 | 05/01/2008 - 06/01/2008 | 06/01/2008 - 07/01/2008 | 08/01/2008 - 09/01/2008 | 09/01/2008 - 10/01/2008 | 10/01/2008 - 11/01/2008 | 03/01/2009 - 04/01/2009 | 06/01/2009 - 07/01/2009 |

 
Copyright © 2007 - vmprofessional. All rights reserved.