Skip to content

[Bug]: This is not actually runnable in PS7 #4055

@f4n0

Description

@f4n0

BCContainerhelper version

6.1.9

Describe the issue

I'm trying to run the container creation via a c# application that is using "Microsoft.PowerShell.SDK" (so pure ps7).
The import-module won't work because it will throw an error "the property access cannot be found"

$access = $acl.Access | Where-Object { $_.IdentityReference -eq $rule.IdentityReference -and $_.FileSystemRights -eq $rule.FileSystemRights -and $_.AccessControlType -eq $rule.AccessControlType -and $_.InheritanceFlags -eq $rule.InheritanceFlags }

By importing the module with the -Silent switch, the import will work, but then it will thorw another exception:

"The 'Get-CimInstance' command was found in the module 'CimCmdlets', but the module could not be loaded due to the following error"

$os = (Get-CimInstance Win32_OperatingSystem)

I'm quite sure that if I find a workaround for the last error, I will encounter another one.

Am I missing something? Is there a REAL way to run ONLY with PURE PS7?

Command or script used to produce the issue

Import-module
New-BcContainer

Full output of the command or script

The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The property 'Access' cannot be found on this object. Verify that the property exists.

Callstack:

at Check-BcContainerHelperPermissions, C:\Users<user>\Documents\PowerShell\Modules\BcContainerHelper\6.1.9\Check-BcContainerHelperPermissions.ps1: line 59 at , C:\Users<user>\Documents\PowerShell\Modules\BcContainerHelper\6.1.9\BcContainerHelper.psm1: line 102 at , C:\Users<user>\Documents\PowerShell\Modules\BcContainerHelper\6.1.9\Import-BcContainerHelper.ps1: line 30 at , : line 21

Full error object:

Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
Microsoft.PowerShell.Commands.Internal.Format.GroupStartData
Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
Microsoft.PowerShell.Commands.Internal.Format.GroupEndData
Microsoft.PowerShell.Commands.Internal.Format.FormatEndData

SECOND ERROR

The 'Get-CimInstance' command was found in the module 'CimCmdlets', but the module could not be loaded due to the following error: [Cannot find the built-in module 'CimCmdlets' that is compatible with the 'Core' edition. Please make sure the PowerShell built-in modules are available. They usually come with the PowerShell package under the $PSHOME module path, and are required for PowerShell to function properly.] For more information, run 'Import-Module CimCmdlets'.

Callstack:

at New-BcContainer, C:\Users<user>\Documents\PowerShell\Modules\BcContainerHelper\6.1.9\ContainerHandling\New-NavContainer.ps1: line 419 at , : line 52

Full error object:

Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
Microsoft.PowerShell.Commands.Internal.Format.GroupStartData
Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
Microsoft.PowerShell.Commands.Internal.Format.GroupEndData
Microsoft.PowerShell.Commands.Internal.Format.FormatEndData

Additional information

No response

Does this happen every time?

Yes

Did this used to work?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions