-
Notifications
You must be signed in to change notification settings - Fork 65
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
VMSwitch DSC resource throws "Impossible to convert« System.String[] » into « System.String
#146
Comments
@lovilak Could you provide the verbose output when you run this? Obfuscate any sensitive information. |
This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close. |
Hello, win_dsc: I get : failed to cast property MaximumSizeBytes from '2GB' of type System.String to type System.UInt64, the DSC engine may ignore this property with an invalid cast |
@lovilak It doesn't look like this is the same issue. '2GB' must be interpreted as a string, and was not converted to the correct value 2GB normally gets converted to
If you change the property to |
Ok, I will test again this 2 points in few days and I comeback to you with some results. ThankYou for your support. |
I’ve run into this issue as well. When run verbos I get the following: VERBOSE: [DSC-HVTEST]: VERBOSE: [DSC-HVTEST]: LCM: [ End Set ] VERBOSE: Operation 'Invoke CimMethod' complete. Using I’m guessing the easiest fix would be to preprocess $NetAdapterName down to a System.String befor calling |
Labeling this as a bug, and help wanted so that anyone in the community can run with it. |
Is this still an active bug and something that needs to be address? Hyper-V module 2.0 (Server 2016) supports String[] for If it needs to be addressed, and |
If it is like you said, that this was extended in Windows Server 2016, then I would rather see it throws an error if it is passed a string array when the module is v1.1. Or, rather it checks if the parameter type of the |
I don't have a system to test on at the moment, but my memory was that problem is that a [string] was being formatted as a [string[]] which was being rejected by new-VMswitch even though it was a single element. So at the very least single elements needed to be cast to [string], and the error could be improved. |
Yeah, so, the error is that if a user passes in a single string for Since HyperV 1.1 module doesn't accept I have availability to pick this up and have actually made a fix on the fly for some work I was doing. I'm just not sure what the community believes the best way forward would be? I would assume checking the I think that in the case where a users does pass in an array for |
As this is an "x" resource wouldn't it make sense to update it to only support [string] as the underlying cmdlet does? If someone has a config built for older versions it could break, but as new-vmswitch does not support it, passing an array is already broken. |
You have it reversed. The newer module supports an array. The older one does not. Here's the documentation on New-VMSwitch If having the DSC resource not be backwards compatible is fine, then it's working as expected and throwing the correct error. |
Oh my bad, I misread your explanation. I'd agree with what your proposed solution to check hyperv version and if -le 1.1 check Is there any point in trying to guess out of an array which element to choose if there config is incompatible? Wouldn't it be a more predictable outcome to just error out and allow the operator to rebuild? |
"Impossible to convert« System.String[] » into « System.String
Hello,
I've this message when I try to create a new Vswitch with this params :
Name: 'NEW_SWITCH'
Type: 'External'
Ensure: 'Present'
NetAdapterName: 'MY_TEAM'
I've this message : "Impossible de convertir « System.String[] » en type « System.String », requis par le paramètre « NetAdapterName ». La méthode spécifiée n'est pas prise en charge. La ressource DSC PowerShell [xVMSwitch]DirectResourceAccess avec SourceInfo a levé une ou plusieurs erreurs sans fin d'exécution lors du lancement de la fonctionnalité Set-TargetResource. Ces erreurs sont enregistrées dans le canal ETW appelé Microsoft-Windows-DSC/Operational"
Thanks for your help
The text was updated successfully, but these errors were encountered: