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

HCI 22H2 : CreateParentDisks.ps1 failed with error "Method invocation failed because [System.Char] does not contain a method named 'contains'." #579

Closed
edronne opened this issue Mar 5, 2024 · 1 comment

Comments

@edronne
Copy link

edronne commented Mar 5, 2024

Hello,

I downloaded HCI 22H2 ISO from Azure portal.
When executing the script "2_CreateParentDisks.ps1" it failed with error below.
I think it's because the ISO contains only one image.

_Method invocation failed because [System.Char] does not contain a method named 'contains'.
At F:\Lab\mslab2-hci\2_CreateParentDisks.ps1:665 char:13

  •     If ($WindowsImage.ImageName[0].contains("Server")){
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : MethodNotFound

Method invocation failed because [System.Char] does not contain a method named 'contains'.
At F:\Lab\mslab2-hci\2_CreateParentDisks.ps1:671 char:13

  •     if ($WindowsImage.ImageName[0].contains("Server") -and $windo ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : MethodNotFound

Get-WindowsImage : There is no matching image.
At F:\Lab\mslab2-hci\2_CreateParentDisks.ps1:683 char:21

  • ... $imageInfo=(Get-WindowsImage -ImagePath "$($ServerMediaDriveLetter):\ ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (Microsoft.Dism.Commands.BaseDismObject:BaseDismObject) [Get-WindowsImage]
      , PSArgumentException
    • FullyQualifiedErrorId : Get-WindowsImage,Microsoft.Dism.Commands.GetWindowsImageCommand_

image

@edronne
Copy link
Author

edronne commented Mar 5, 2024

Sorry. I try to use the 2_CreateParentDisks.ps1 rather than ParentDisks\CreateParentDisk.ps1

@edronne edronne closed this as completed Mar 5, 2024
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

1 participant