Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Cannot index into a null array. #194

Closed
Theunifiller opened this issue Sep 20, 2019 · 5 comments
Closed

Cannot index into a null array. #194

Theunifiller opened this issue Sep 20, 2019 · 5 comments
Labels

Comments

@Theunifiller
Copy link

If i run the script after installing the module en setting up the host on my g: drive i get the following:

PS G:\AutoLab\Configurations\PowerShellLab> unattend-lab

   This runs Setup-Lab, Run-Lab, and Validate-Lab

Starting the lab environment

    This is the Setup-Lab script. This script will perform the following:

    * Run the configs to generate the required .mof files
    Note! - If there is an error creating the .mofs, the setup will fail

    * Run the lab setup
    Note! If this is the first time you have run this, it can take several
    hours to download the ISO files and resources depending on the configuration.
    You may also see new drives being added and removed as the ISO is mounted
    and converted. This step should only happen the first time you run this
    command.

    ** Possible problem
    If the downloads finish but the script doesn't continue (pauses),
    press the Enter key once and it should continue

    *You will be able to wipe and rebuild this lab without needing to perform
    the downloads again.

Installing required DSCResource modules from PSGallery
You may need to say "yes" to a Nuget Provider
Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\PSAutoLab\4.1.1\functions\public.ps1:230 char:13

  •     if ($dscmod[0].version -ne ($DSCResource.RequiredVersion -as  ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\PSAutoLab\4.1.1\functions\public.ps1:230 char:13

  •     if ($dscmod[0].version -ne ($DSCResource.RequiredVersion -as  ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray

Build the .Mof files from the configs
At G:\AutoLab\Configurations\PowerShellLab\VMConfiguration.ps1:26 char:5

  • Import-DSCresource -ModuleName PSDesiredStateConfiguration,
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Could not find the module '<xComputerManagement, 2.0.0.0>'.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : ModuleNotFoundDuringParse

Building the lab environment for PowerShellLab

Name Value


Password System.Security.SecureString
NoSnapshot True
WarningAction SilentlyContinue
Path G:\AutoLab\Configurations\PowerShellLab
IgnorePendingReboot True
ConfigurationData G:\AutoLab\Configurations\PowerShellLab*.psd1

Cannot locate node 'DOM1' file and no DSC configuration can be applied. Ensure the DSC configuration has been run succe
ssfully.
At line:114 char:13

  •         throw ($localized.CannotLocateMofFileError -f $Name);
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Cannot locate n...n successfully.:String) [], RuntimeException
    • FullyQualifiedErrorId : Cannot locate node 'DOM1' file and no DSC configuration can be applied. Ensure the DSC c
      onfiguration has been run successfully.

PS G:\AutoLab\Configurations\PowerShellLab>

What do i have to do to make the script run without errors?

@jdhitsolutions
Copy link
Collaborator

Can you run Get-PSAutolabSetting and post the result? Is this a new install of the module or did you have older versions installed? For some reason the DSC resources aren't being download which causes everything else to fail. Are you running in an elevated Power Shell session?

I am finishing up a conference in India and then flying back to the US so any other responses will be delayed.

I don't have an easy answer. I have built that lab several times on different systems so it should work. We need to figure out where you are different.

@Theunifiller
Copy link
Author

It is a new install but i had older versions on the pc.
I removed the older version and deleted the old autolab folder completely.
I rebooted the pc and after that I followed the instructions as mentioned.
I started powershell as an administrator.
The output you asked for looks like:

PS G:\AutoLab\Configurations\PowerShellLab> Get-PSAutolabSetting

PSVersion : 5.1.17763.592
Edition : Desktop
OS : Microsoft Windows 10 Pro
PSAutolab : 4.1.1
Lability : 0.18.0
Memory : 67069200

@jdhitsolutions
Copy link
Collaborator

working on an update.

@jdhitsolutions
Copy link
Collaborator

I think I found the problem. Updated the code to better handle checking DSC resource module versions. Update to 4.2.0 which I just published to the PowerShell Gallery and try again. Run Refresh-Host after you upgrade to copy over the latest configuration files.

@Theunifiller
Copy link
Author

It works fine now, thanks.

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

No branches or pull requests

2 participants