Automation

 View Only
  • 1.  Backing up ESXi 4 configuration using Powershell

    Posted Sep 13, 2010 07:16 AM

    Hi All,

    Is it possible using PowerCLI 4.1 to capture all of the ESXi settings and the iSCSI connection information as well to Windows machine ?

    i heard that it is possible using vMA 4 but wondering if ti is possible now using PowerCLI.

    Thanks,

    Kind Regards,

    AWT



  • 2.  RE: Backing up ESXi 4 configuration using Powershell

    Posted Sep 13, 2010 07:32 AM

    I suspect you mean the settings that William mentioned in his What is VMware vsish? post ?

    The iSCSI connection information can be accessed via

    $esx = Get-VMHost <esxname>
    $esx.Extensiondata.config.storageDevice.hostBusAdapter | where{$_.GetType().Name -eq "HostInternetScsiHba"}
    

    Depending on which iSCSI settings you want, the data can be extracted from that object.

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 3.  RE: Backing up ESXi 4 configuration using Powershell

    Posted Sep 13, 2010 07:45 AM

    almost right Luc :smileyhappy:

    but i got error when i execute your script from my VESI script editor:

    You cannot call a method on a null-valued expression.

    At :line:2 char:73

    + $esx.Extensiondata.config.storageDevice.hostBusAdapter | where{$_.GetType <<<< ().Name -eq "HostInternetScsiHba"}

    what i want to achieve is the overall ESXi profile just like vMA vicfg-cfgbackup command.

    Kind Regards,

    AWT



  • 4.  RE: Backing up ESXi 4 configuration using Powershell

    Posted Sep 13, 2010 07:48 AM

    VESI, that means you're probably using PowerCLI 4u1.

    Then you have to do it like this

    $esx = Get-VMHost <esxname> | Get-View
    $esx.config.storageDevice.hostBusAdapter | where{$_.GetType().Name -eq "HostInternetScsiHba"}
    

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 5.  RE: Backing up ESXi 4 configuration using Powershell
    Best Answer

    Posted Sep 13, 2010 07:51 AM

    The equivalent to vicfg-cfgbackup is Set-VMHostFirmware. You use the BackupConfiguration parameter to create a backup.




    Dave

    VMware Communities User Moderator

    Now available - vSphere Quick Start Guide

    Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.



  • 6.  RE: Backing up ESXi 4 configuration using Powershell

    Posted Sep 13, 2010 08:08 AM

    Yes, that is just what I' wondering around, after executing the command, here's what I've got:

    C:\Downloads>dir /s

    Volume in drive C is OS

    Volume Serial Number is 6A23-8FCA

    Directory of C:\Downloads

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    13/09/2010 06:03 PM 15,596 configBundle-ESXi01.domain.com.tgz

    13/09/2010 06:04 PM <DIR> etc

    13/09/2010 06:03 PM 68 Manifest.txt

    2 File(s) 15,664 bytes

    Directory of C:\Downloads\etc

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    01/06/2010 08:32 PM 171 chkconfig.db

    01/12/2009 06:02 PM 954 dhclient-vmk0.leases

    13/09/2010 06:04 PM <DIR> dropbear

    01/12/2009 06:10 PM 121 group

    01/06/2010 08:26 PM 217 hosts

    01/12/2009 06:09 PM 1,567 inetd.conf

    01/12/2009 06:14 PM 111 ntp.conf

    13/09/2010 05:31 PM 7 ntp.drift

    13/09/2010 06:04 PM <DIR> opt

    01/06/2010 08:32 PM 341 passwd

    01/06/2010 08:27 PM 512 random-seed

    01/12/2009 06:08 PM 62 resolv.conf

    13/09/2010 06:04 PM <DIR> sfcb

    01/09/2010 01:19 PM 264 shadow

    13/09/2010 06:04 PM <DIR> sysconfig

    01/12/2009 06:00 PM 30 syslog.conf

    13/09/2010 06:04 PM <DIR> vmware

    12 File(s) 4,357 bytes

    Directory of C:\Downloads\etc\dropbear

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    01/12/2009 06:00 PM 458 dropbear_dss_host_key

    01/12/2009 06:00 PM 426 dropbear_rsa_host_key

    2 File(s) 884 bytes

    Directory of C:\Downloads\etc\opt

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    13/09/2010 06:04 PM <DIR> vmware

    0 File(s) 0 bytes

    Directory of C:\Downloads\etc\opt\vmware

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    13/09/2010 06:04 PM <DIR> vpxa

    0 File(s) 0 bytes

    Directory of C:\Downloads\etc\opt\vmware\vpxa

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    22/07/2010 10:35 AM 89 dasConfig.xml

    01/09/2010 01:19 PM 1,294 vpxa.cfg

    2 File(s) 1,383 bytes

    Directory of C:\Downloads\etc\sfcb

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    13/09/2010 06:04 PM <DIR> repository

    0 File(s) 0 bytes

    Directory of C:\Downloads\etc\sfcb\repository

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    13/09/2010 06:04 PM <DIR> root

    0 File(s) 0 bytes

    Directory of C:\Downloads\etc\sfcb\repository\root

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    13/09/2010 06:04 PM <DIR> interop

    0 File(s) 0 bytes

    Directory of C:\Downloads\etc\sfcb\repository\root\interop

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    08/11/2009 07:01 PM 0 cim_indicationfilter.idx

    08/11/2009 07:01 PM 0 cim_indicationhandlercimxml.idx

    08/11/2009 07:01 PM 0 cim_indicationsubscription.idx

    08/11/2009 07:01 PM 0 cim_listenerdestinationcimxml.idx

    4 File(s) 0 bytes

    Directory of C:\Downloads\etc\sysconfig

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    01/12/2009 06:08 PM 43 network

    1 File(s) 43 bytes

    Directory of C:\Downloads\etc\vmware

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    01/06/2010 08:32 PM 453 config

    13/09/2010 06:02 PM 512 dvsdata.db

    31/08/2010 02:05 PM 35,816 esx.conf

    13/09/2010 06:04 PM <DIR> hostd

    30/01/2010 07:04 PM 168 license.cfg

    01/12/2009 06:00 PM 52 locker.conf

    07/09/2010 03:20 AM 62 settings

    01/12/2009 06:01 PM 114 snmp.xml

    13/09/2010 06:04 PM <DIR> ssl

    13/09/2010 06:04 PM <DIR> vmkiscsid

    01/06/2010 08:32 PM 29 vmware.lic

    8 File(s) 37,206 bytes

    Directory of C:\Downloads\etc\vmware\hostd

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    01/06/2010 08:32 PM 885 authorization.xml

    01/06/2010 08:58 PM 169 hostsvc.xml

    13/09/2010 04:59 PM 2,955 pools.xml

    01/06/2010 08:32 PM 2,183 proxy.xml

    30/08/2010 10:28 AM 399 vmAutoStart.xml

    09/09/2010 10:08 AM 3,357 vmInventory.xml

    6 File(s) 9,948 bytes

    Directory of C:\Downloads\etc\vmware\ssl

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    01/12/2009 06:00 PM 989 rui.crt

    01/12/2009 06:00 PM 887 rui.key

    2 File(s) 1,876 bytes

    Directory of C:\Downloads\etc\vmware\vmkiscsid

    13/09/2010 06:04 PM <DIR> .

    13/09/2010 06:04 PM <DIR> ..

    01/12/2009 06:20 PM 52 initiatorname.iscsi

    08/11/2009 06:50 PM 0 iscsid.conf

    09/07/2010 11:14 AM 24,576 vmkiscsid.db

    3 File(s) 24,628 bytes

    Total Files Listed:

    42 File(s) 95,989 bytes

    44 Dir(s) 80,459,739,136 bytes free

    C:\Downloads>

    glad to hear that finally using PowerCLI can be the same as vMA at least less system file transfer.

    Kind Regards,

    AWT