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
Have a look at Matt's Backup/Export Full DRS Rule Info via PowerShell
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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!
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
Since your question triggered it, you might be interested to know that mattboren 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
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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 ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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