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
Invoke-ScriptInBcContainer/Enter-BcContainer fails to load other powershell modules #3330
Comments
When you say: What I don't get is: some have it others not. |
"keep powershell modeules" up2date...same like fighting windmills ;) when I see it I breach it again and again....fun aside...when I say "some works others not"... so I have set it to true and I don't have any issues, but the developer with the same sort of setup: non admin, same version, does get the issue... Well.... I did try to enter-bccontainer import which did not work, and I think it did not because of the "scope" / admin ... that was also why I started to tell them set the PsSession to false such that it runs "isolated" or in it's own scope (or what ever it for real means). I will try to find someone and redo to get the correct error. Never experienced this delay in file copy....will also have an eye on this. |
I got the same error message ( On further research loading the Microsoft.PowerShell.Archive module failed inside the container with the following error: Import-Module Microsoft.PowerShell.Archive
Cannot find the Windows PowerShell data file 'ArchiveResources.psd1' in directory
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\de-DE\', or in any
parent culture directories.
+ CategoryInfo : ObjectNotFound: (C:\Windows\syst...eResources.psd1:String) [Import-Localiz
edData], PSInvalidOperationException
+ FullyQualifiedErrorId : ImportLocalizedData,Microsoft.PowerShell.Commands.ImportLocalizedData So it tries to load the de-DE localization data (my host system is de-DE). On the Internet I found a workaround with copying the en-US files to the de-DE folder, but since this was done while running $culture = [System.Globalization.CultureInfo]::GetCultureInfo("en-US")
[System.Threading.Thread]::CurrentThread.CurrentCulture = $culture
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture Not sure if this helps finding the problem. |
Did you add these lines to the script you invoke inside the container? |
On the host |
so the last guy reported the issue to me is using hyperv :( |
I did try process and hyperv isolation. Got the same error on both modes. Should the container normally be created with en-US or the culture of the host? |
This is what I think: If you have a running container - and then start a new PowerShell prompt and run this script:
Restart the PowerShell prompt and re-run the same script. Thanks |
I was trying it first with my still existing container: First run (PowerShell 5 with admin rights) BcContainerHelper version 6.0.6-preview1129
Setting MicrosoftTelemetryConnectionString =
Name Value
---- -----
PSVersion 5.1.19041.3930
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3930
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Host Culture Before: de-DE
Host UICulture Before: de-DE
Container Culture Before: en-US
Container UI Culture Before: en-US
Container Culture After: en-US
Container UI Culture After: en-US
Host Culture After: de-DE
Host UICulture After: de-DE Second run (PowerShell 5 with admin rights) BcContainerHelper version 6.0.6-preview1129
Setting MicrosoftTelemetryConnectionString =
Name Value
---- -----
PSVersion 5.1.19041.3930
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3930
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Host Culture Before: de-DE
Host UICulture Before: de-DE
Container Culture Before: en-US
Container UI Culture Before: en-US
Container Culture After: en-US
Container UI Culture After: en-US
Host Culture After: de-DE
Host UICulture After: de-DE I couldn't run it without admin or with admin and powershell core, because on these sessions I tried to reproduce the error but did a pull of the newest version from https://github.com/microsoft/BusinessCentralApps before. Now I can't reproduce it. |
I have this from one of my developers: we get the same first and second run:
Same here with the New-PsSession and a containerID had to start an admin Shell to execute the command. for the fun I checked my (just fine working) machine it says:
while my container says:
|
another developer, another output:
and the second round:
|
Sorry, late to the party. I will give it a try and forward to the folks having the issue. As all works for my setup I need to find a Guinea pig ;) |
nope. that did not work. |
A beautiful, typical, rainy Wednesday morning! You can almost smell the summer in DK! :D
I get lately more of the following reported by the dev team:
"The Expand-Archive command was found in the module "blablabla", but the module could not be loaded." What has bccontainerhelper tp do with this? well:
What I added in our scripts was some Invoke-ScriptInBcContainer, that after I moved in some zip file to the container, is about to extract the content within the container to some folder ... and that worked well, but now I get, as I said, more and more reports on this....
Not sure what triggered this "massive" raise on reports. While I investigate I could also see, it has the same issue with Enter-BcContainer ( while Open-BcContainer just worked fine).... so that lead me to: Must be the Session handling...
So my current attempt to help people out: switch the $bcContainerHelperConfig.UsePsSession flag to false. What I don't get is: some have it others not.
There is one "unique" approach we (are forced to ) use: run everything as normal users ( IT took away the local administrator rights if you maybe recall)
So my current theory is : something is not good in identifying the circumstances about that "state" the user is trigging the commands... I recall some comment on PsSession about identifying if it should use a given Session or do docker run command instead...
And because this is all I have around this topic I will leave it to you if this is worth to look in or not :D
Maybe it is at least helping others with the same issue ?!
I could ask: Is it "ok" to force the UsePsSession to false on all our machines? Do we "lose" functionality? (not that it ends up in a like the "pick your Isolation poison" dilemma ).
The text was updated successfully, but these errors were encountered: