Automation

 View Only
  • 1.  Export DRS rules including DRS groups

    Posted Jul 31, 2013 03:30 PM

    I'm looking for a way to export a listing of DRS groups. I found some scripts that will export/import DRS rules, but they ony apply to affinity/anti-affinity for VMs - like these:

    http://ict-freak.nl/2009/08/28/powercli-export-import-and-create-drs-rules/

    Is there any way to export the DRS host/vm group information and the rules for running VM's on specific hosts?

    Also found these scripts as well

    Re: Backup/Restore DRS VM affinity/anti-affinity rules - can these be backed up and restored without manually re-enterin…



  • 2.  RE: Export DRS rules including DRS groups

    Posted Jul 31, 2013 05:25 PM


  • 3.  RE: Export DRS rules including DRS groups

    Posted Dec 30, 2014 04:45 PM

    LucD wrote:

    Have a look at Matt's Backup/Export Full DRS Rule Info via PowerShell

    Anyknow know if he ever posted an update blog on Restor/Import?  I need to move a datacenter/cluster from one vcenter to another and this would be extremely helpful.  DRS Affinity Rules are easy... The DRS Group Creation/Member adds that need to come first are where I'm stuck.

    Thanks!



  • 4.  RE: Export DRS rules including DRS groups

    Posted Dec 31, 2014 02:58 AM

    Hello, OsburnM-

    Yes, I know:  he never did write a subsequent post for restoring/importing rules from the exported "full" DRS rule info.

    I also know:  he just today took a bit of time to write the code for such things.  And, he I will write that subsequent post in the next day or two, and include this new code for "importing" from the exported rule info.  I will update this thread once I have made said post.  Until then, happy holidays.

    Matt



  • 5.  RE: Export DRS rules including DRS groups

    Posted Jan 22, 2015 05:45 PM

    Since your question triggered it, you might be interested to know that  and myself posted the DRSRule module today, including import and export cmdlets :smileycool:

    Have a look at our posts on the subject: DRSRule - New PowerShell Module for DRS Rule and Group Management and DRSRule – a DRS rules and groups module



  • 6.  RE: Export DRS rules including DRS groups

    Posted Jun 18, 2015 12:48 AM

    Hi LucD and mattboren

    Left you a message in your blog entry, hope you can give me a reply

    I am experiencing this error using pcli6 connected to VC 5.1@

    Get-DrsVMtoVMRule : Unable to find type [DRSRule.VMToVMRule]. Make sure that

    the assembly that contains this type is loaded.

    At C:\Program Files\VMware\Infrastructure\vSphere

    PowerCLI\Modules\DRSRule\DRSRule.psm1:1066 char:9

    +        (Get-DrsVMtoVMRule @hshParamsForGetCall),

    +         ~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidOperation: (DRSRule.VMToVMRule:TypeName)

       [], RuntimeException

        + FullyQualifiedErrorId : TypeNotFound



  • 7.  RE: Export DRS rules including DRS groups

    Posted Jun 18, 2015 01:29 PM

    Does your $PSModulePath variable contain the folder where you stored the DRSRule files ?

    How did you load the module ? Implicit or auto-load ?

    Which PowerShell version are you using ?



  • 8.  RE: Export DRS rules including DRS groups

    Posted Jun 26, 2015 01:53 PM

    Hi Luc. I have the same problem. follows the error when the import module.

    Windows Powershell 4.0

    Powercli 5.8 Release 1

    Add-Type : (0) : Metadata file '\VMware\Infrastructure\vSphere PowerCLI\VMware.Vim.dll' could not be found

    (1) :   using VMware.Vim;

    At C:\Users\n813114\Documents\WindowsPowerShell\Modules\DRSRule\DRSRule.init.ps1:3 char:1

    + Add-Type -ReferencedAssemblies $pcliDll -TypeDefinition @"

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidData: (error CS0006: M...ld not be found:CompilerError) [Add-Type], Exception

        + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand

    Add-Type : Cannot add type. Compilation errors occurred.

    At C:\Users\n813114\Documents\WindowsPowerShell\Modules\DRSRule\DRSRule.init.ps1:3 char:1

    + Add-Type -ReferencedAssemblies $pcliDll -TypeDefinition @"

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidData: (:) [Add-Type], InvalidOperationException

        + FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand



  • 9.  RE: Export DRS rules including DRS groups

    Posted Jun 30, 2015 08:34 PM

    Hi Luc,

    Thanks for your reply.

    I tried to import the module and also copy the files to the folder for auto load using powershell 4.

    Regards