VMware Cloud Community
AntonioMP
Contributor
Contributor
Jump to solution

Issue using DRSRule module

Hi all, I'm having some issue using the great DRSRule module from Lucd

DRSRule - a DRS rules and groups module - LucD notes

Environment VCSA 6.7 build 9232925, with ESXi 6.7 GA,

This is my PowerCLI setup:

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> $PSVersionTable

Name                           Value                                                                                                                         

----                           -----                                                                                                                         

PSVersion                      5.1.14409.1005                                                                                                                

PSEdition                      Desktop                                                                                                                       

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                       

BuildVersion                   10.0.14409.1005                                                                                                               

CLRVersion                     4.0.30319.42000                                                                                                               

WSManStackVersion              3.0                                                                                                                           

PSRemotingProtocolVersion      2.3                                                                                                                           

SerializationVersion           1.1.0.1                                                                                                                       

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> Get-Module -ListAvailable -Name VMware*

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                   

---------- -------    ----                                ----------------                                                                                   

Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-DeployRule...}                            

Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Export-EsxImageProfile...} 

Manifest   10.2.0.... VMware.PowerCLI                                                                                                                        

Script     6.7.0.9... VMware.Vim                                                                                                                             

Script     10.1.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer, Disconnect-CisServer, Get-CisService}                                          

Script     10.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog...}                           

Script     10.1.0.... VMware.VimAutomation.Common                                                                                                            

Script     10.1.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer...}

Script     6.5.4.7... VMware.VimAutomation.HA             Get-DrmInfo                                                                                        

Script     7.5.0.8... VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}                                                            

Script     10.0.0.... VMware.VimAutomation.License        Get-LicenseDataManager                                                                             

Script     10.2.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}                                       

Script     10.0.0.... VMware.VimAutomation.PCloud         {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInstance, Get-PIDatacenter}                   

Script     10.1.0.... VMware.VimAutomation.Sdk            {Get-PSVersion, Get-InstallPath}                                                                   

Script     10.0.0.... VMware.VimAutomation.Srm            {Connect-SrmServer, Disconnect-SrmServer}                                                          

Script     10.1.0.... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePolicy, Get-KeyManagementServer...}        

Script     1.2.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore                                                                               

Script     10.1.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup, Export-VDSwitch...}   

Script     10.0.0.... VMware.VimAutomation.Vmc            {Connect-Vmc, Disconnect-Vmc, Get-VmcService, Connect-VmcServer...}                                

Script     10.0.0.... VMware.VimAutomation.vROps          {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition...}                     

Script     6.5.1.7... VMware.VumAutomation                {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Compliance...}                                  

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> Get-Module -ListAvailable -Name DRS*

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                   

---------- -------    ----                                ----------------                                                                                   

Script     1.2.1      DRSRule                             {Get-DrsVMGroup, Get-DrsVMHostGroup, Get-DrsVMToVMHostRule, Get-DrsVMToVMRule...}                 

PowerCLi is working well for other tasks, but if i try export the cluster DRS rules I have an error:

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> Export-DrsRule -cluster XXXXXXXXX -path C:\BCK\DRSRules_XXXXXXXX_13Sep2018.json

Impossibile trovare il tipo [DRSRule.VMToVMRule].

In C:\Program Files\WindowsPowerShell\Modules\DRSrule\DRSRule.psm1:271 car:15

+   [OutputType([DRSRule.VMToVMRule],[VMware.Vim.ClusterAffinityRuleSpe ...

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

    + CategoryInfo          : InvalidOperation: (DRSRule.VMToVMRule:TypeName) [], RuntimeException

    + FullyQualifiedErrorId : TypeNotFound

DRSRule module was imported without errors and the following commands are working fine:

Get-DrsClusterGroup, Get-DrsRule, Get-DrsVMHostRule

While the following give similar errors:

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> Get-DrsVMGroup

Impossibile trovare il tipo [DRSRule.VMGroup].

In C:\Program Files\WindowsPowerShell\Modules\DRSrule\DRSRule.psm1:55 car:15

+   [OutputType([DRSRule.VMGroup],[VMware.Vim.ClusterVmGroup])]

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

    + CategoryInfo          : InvalidOperation: (DRSRule.VMGroup:TypeName) [], RuntimeException

    + FullyQualifiedErrorId : TypeNotFound

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> Get-DrsVMHostGroup

Impossibile trovare il tipo [DRSRule.VMHostGroup].

In C:\Program Files\WindowsPowerShell\Modules\DRSrule\DRSRule.psm1:167 car:15

+   [OutputType([DRSRule.VMHostGroup],[VMware.Vim.ClusterHostGroup])]

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

    + CategoryInfo          : InvalidOperation: (DRSRule.VMHostGroup:TypeName) [], RuntimeException

    + FullyQualifiedErrorId : TypeNotFound

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> Get-DrsVMToVMHostRule

Impossibile trovare il tipo [DRSRule.VMToVMHostRule].

In C:\Program Files\WindowsPowerShell\Modules\DRSrule\DRSRule.psm1:388 car:15

+   [OutputType([DRSRule.VMToVMHostRule],[VMware.Vim.ClusterVmHostRuleI ...

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

    + CategoryInfo          : InvalidOperation: (DRSRule.VMToVMHostRule:TypeName) [], RuntimeException

    + FullyQualifiedErrorId : TypeNotFound

PS C:\Program Files\WindowsPowerShell\Modules\DRSRule> Get-DrsVMToVMRule

Impossibile trovare il tipo [DRSRule.VMToVMRule].

In C:\Program Files\WindowsPowerShell\Modules\DRSrule\DRSRule.psm1:271 car:15

+   [OutputType([DRSRule.VMToVMRule],[VMware.Vim.ClusterAffinityRuleSpe ...

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

    + CategoryInfo          : InvalidOperation: (DRSRule.VMToVMRule:TypeName) [], RuntimeException

    + FullyQualifiedErrorId : TypeNotFound

Probably there is a misconfiguration on my specific setup?

Thanks for any hints, regards

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Looks like they moved the vmware.vim.dll module since 10.1

Can you try replacing the DRSRule.init.ps1 file in the DRSRule module folder with the attached file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Looks like they moved the vmware.vim.dll module since 10.1

Can you try replacing the DRSRule.init.ps1 file in the DRSRule module folder with the attached file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
AntonioMP
Contributor
Contributor
Jump to solution

Really great job Luc!!!

Now is working like a charm, we need to migrate hundreds of VM to a new cluster and thanks to your module now we can recreate all the DRS rules with few moments.

Thanks again!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Thanks.
I'll patch the github repo and submit a new version to the PSGallery.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos