Open mikedhanson opened 3 weeks ago
That's a good question. I don't know why this would work in a regular prompt and not PSU unless they are doing some other kind of special assembly auto loading. It's pretty clear that the assembly just isn't loaded so it doesn't know what the type is but I've never actually noticed this with non-custom DLLs. I have noticed this with PSU DLLs themself. We need to ensure they are loaded.
You could add the AD module to the environment's modules section and it will load the module while creating the runspace.
Version
4.3.4
Severity
Low
Environment
msi
Steps to Reproduce
I am running into a weird PSU thing where I have a script that has a param with a type of " [Microsoft.ActiveDirectory.Management.ADAccount]" and when I run the script it throws the following error
[error] Unable to find type [Microsoft.ActiveDirectory.Management.ADAccount].
However, if I wrap that param block in a function and do the AD import before that function call it works. I am running this in a external pwsh environment.
Does not work
Works
This also works when you use #requies
Expected behavior
Actual behavior
Additional Environment data
No response
Screenshots/Animations
No response