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

Bug: New-Lab -ConfigPath parameter doesn't check if entry contains .xml #372

Open
DennisL68 opened this issue Oct 14, 2020 · 0 comments
Open
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@DennisL68
Copy link

Verison of PowerShell: 
$PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  1007

PowerShell host:
Console

Operating system:
Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, ServicePackMajorVersion, OSArchitecture, WindowsDirectory


Caption                 : Microsoft Windows Server 2019 Standard
Version                 : 10.0.17763
ServicePackMajorVersion : 0
OSArchitecture          : 64-bit
WindowsDirectory        : C:\Windows


Version of LabBuilder:
PS C:\Windows\system32> Get-Module -Name LabBuilder -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.5.105  LabBuilder                          {Get-LabResourceModule, Initialize-LabResourceModule, Get-...

Creating a new lab specifying only a folder path will output a lot of errors.

C:\Windows\system32> New-Lab -Name TestLab -LabPath c:\users\public\TestLab -ConfigPath C:\users\Public\TestLab
Exception calling "Save" with "1" argument(s): "Access to the path 'C:\users\Public\TestLab' is denied."
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:10056 char:5
+     $Lab.Save($ConfigPath)
+     ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Get-Content : Access to the path 'C:\users\Public\TestLab' is denied.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6174 char:16
+     $content = Get-Content -Path $ConfigPath -Raw
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\users\Public\TestLab:String) [Get-Content], UnauthorizedAccessExce
   ption
    + FullyQualifiedErrorId : GetContentReaderUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand

New-LabException : Configuration file C:\users\Public\TestLab is empty.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6184 char:9
+         New-LabException @exceptionParameters
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-LabException], Exception
    + FullyQualifiedErrorId : ConfigurationFileEmptyError,New-LabException

Assert-LabValidConfigurationXMLSchema : Exception calling "Create" with "2" argument(s): "Access to the path
'C:\users\Public\TestLab' is denied."
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6190 char:9
+         Assert-LabValidConfigurationXMLSchema `
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Assert-LabValidConfigurationXMLSchema], MethodInvocationException
    + FullyQualifiedErrorId : UnauthorizedAccessException,Assert-LabValidConfigurationXMLSchema

Exception calling "LoadXml" with "1" argument(s): "Root element is missing."
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6198 char:5
+     $lab.LoadXML($content)
+     ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6232 char:5
+     $lab.labbuilderconfig.settings.setattribute('fullconfigpath', $fu ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6237 char:9
+         $lab.labbuilderconfig.settings.SetAttribute('labpath', $labPa ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6254 char:5
+     $lab.labbuilderconfig.settings.setattribute('vhdparentpathfull',  ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6266 char:5
+     $lab.labbuilderconfig.settings.setattribute('dsclibrarypathfull', ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.1.0\LabBuilder.psm1:6278 char:5
+     $lab.labbuilderconfig.settings.setattribute('resourcepathfull', $ ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull



NodeType           : Document
ParentNode         :
DocumentType       :
Implementation     : System.Xml.XmlImplementation
Name               : #document
LocalName          : #document
DocumentElement    :
OwnerDocument      :
Schemas            : System.Xml.Schema.XmlSchemaSet
XmlResolver        :
NameTable          : System.Xml.NameTable
PreserveWhitespace : True
IsReadOnly         : False
InnerText          :
InnerXml           :
SchemaInfo         : System.Xml.Schema.XmlSchemaInfo
BaseURI            :
Value              :
ChildNodes         : {}
PreviousSibling    :
NextSibling        :
Attributes         :
FirstChild         :
LastChild          :
HasChildNodes      : False
NamespaceURI       :
Prefix             :
OuterXml           :
PreviousText       :
@DennisL68 DennisL68 changed the title New-Lab -ConfigPath parameter doesn't check if entry contains .xml Bug: New-Lab -ConfigPath parameter doesn't check if entry contains .xml Oct 14, 2020
@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants