Is it possible to load pwps_dab in PowerShell7? When I try to import it, I get the following error message:
Import-Module: Could not load file or assembly 'BTSTypes, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
I tried using Import-Module pwps_dab -UseWindowsPowerShell and that seems to work, but some functions are not recognized, such as Get-PWFoldersImmediateChildren
Is there a trick that will make pwps_dab load in PowerShell 7?
No "tricks" that I know of. My understanding is that PS 5.1 and PS 7 load modules from different paths and have differences in what they support (versions and architectures of .NET, etc.).
My understanding is that you can have both PS 5.1 and PS 7 "side by side" on a machine.
Dan WilliamsSolution ConsultantBentley Systems, IncorporatedPortland, OR, USA (Pacific Time UTC-08:00)
Thanks for the reply. On Windows 10 machines, I'm pretty sure that PS 7 is always "side by side" with 5.1. I was hoping to take advantage of some new features in PS 7. In particular, ForEach-Object -Parallel
When you load v5.1 module using -UseWindowsPowerShell powershell 7 actually starts a PowerShell 5.1 session in the background and loads the module into that. When objects are passed back and forth they go through a serialization/deserialization that can jack up the objects.
What's the specific error you get trying to use Get-PWFoldersImmediateChildren?
about Windows PowerShell Compatibility - PowerShell | Microsoft Docs
It seems to be specifically when I try to use ForEach-Object -Parallel . If I run the command by itself in a new session, it works. I don't think the error is specific to Get-PWFoldersImmediateChildren I suspect that the compatibility session is not loading my profile. Also, if it is spawning another session, then I guess I would have to log in as part of my ForEach-Object script block? that doesn't seem worth the effort. Anyways, here's the error that I get:The term 'Get-PWFoldersImmediateChildren' is not recognized as a name of a cmdlet, function, script file, or executable program.Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Kevin van Haaren said:PWFoldersImmediateChildren