Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when importing from previously exported VMHost group #23

Open
mtboren opened this issue Oct 1, 2019 · 2 comments
Open

Errors when importing from previously exported VMHost group #23

mtboren opened this issue Oct 1, 2019 · 2 comments

Comments

@mtboren
Copy link
Member

mtboren commented Oct 1, 2019

Opening new issue from comment from user @gillx0101 (original comment here)

Can someone help! I'm able to use the export-drsrule successfully, but get errors when importing the txt file with the following;

Get-DrsRuleObject : Cannot validate argument on parameter 'Object'. The argument is null or empty. Provide an argument
that is not null or empty, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\DRSRule\2.0.0\DRSRule.psm1:1572 char:38

... _filtered | Get-DrsRuleObject -Type 'ClusterAffinityRuleSpec|ClusterA ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidData: (:) [Get-DrsRuleObject], ParameterBindingValidationException
FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DrsRuleObject
I am using Powercli VMware PowerCLI 11.3.0 build 13990089 and verion 2.0.0 of the DRSRule.

I am testing with vcentre 6.7, creating a test VM/Host group, exporting out then deleting from vmware and trying to import back in from the export file. Any pointers would be appreciated.>

@mtboren
Copy link
Member Author

mtboren commented Oct 1, 2019

Hello, @gillx0101

A few things to help us understand what might be happening here:

  • I take it you are on PowerShell 5.* -- is that fact? (What is the PowerShell version you are using)
  • Are we able to do a dry run using the -ShowOnly parameter on the Import-DrsRule invocation that you are making? If so, what is the result?
  • What happens when you try to import just the given DrsVMHostGroup by using the -Name parameter on the Import-DrsRule invocation that you are making?

@gillx0101
Copy link

Thanks @mtboren for taking a look. I am using a Windows 10 client with PS 5.1 installed. Below is the output running with the "ShowOnly" switch

PS C:\WINDOWS\system32> Import-DrsRule d:\temp\drs.txt -ShowOnly
Method invocation failed because [System.Management.Automation.PSCustomObject] does not contain a method named
'GetEnumerator'.
At C:\Program Files\WindowsPowerShell\Modules\DRSRule\2.0.0\DRSRule.psm1:1557 char:7
+       $arrRuleObjects_filtered = $ruleObjects.GetEnumerator() | Where ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (GetEnumerator:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Not sure if I follow your last point? I created a VM Host Group with a name "DRSHost", but when I tried to export got the following:

PS C:\WINDOWS\system32> Export-DrsRule -Name DRSHost

cmdlet Export-DrsRule at command pipeline position 1
Supply values for the following parameters:
Path: d:\temp\drshstsgroup.txt
Unable to find type [DRSRule_VMToVMRule].
At C:\Program Files\WindowsPowerShell\Modules\DRSRule\2.0.0\DRSRule.psm1:271 char:15
+   [OutputType([DRSRule_VMToVMRule],[VMware.Vim.ClusterAffinityRuleSpe ...
+               ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (DRSRule_VMToVMRule:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

I think its worth noting I also get the above intermittently when just running an export-drsrule and providing a path for the output ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants