Besides looking dumping $PSVersionTable
and dumping the variable and env "PS-Drives", what can I do to compare PowerShell environments?
Here's the problem:
- I have very similar machines running Microsoft Windows Server 2012
$PSVersionTable
dumps as:Name Value ---- ----- PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.34014 BuildVersion 6.3.9600.17090 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2
on the server that works, and
Name Value ---- ----- PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.34209 BuildVersion 6.3.9600.16406 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2
on the server that I'm having a problem with.
- Not a whole not of difference in a base
variable:
drive. - Reasonable differences in
env:
contents - And they both have ExecutionPolicy set to RemoteSigned.
So the differences are in the minor version. But the first server will run the Animal classes example that comes with the PSClass deployment, and the second won't.
And I've traced it in the debugger to the second call to Attach-PSScriptMethod
, whether in a debugger or not, the second server just hangs on that call.
Update: Just got a change to update my first server to Build 6.3.30319.34209, the same minor version as the second (and the same CLRVersion). Now the example breaks as well. Looks like Microsoft broke the PSClass library.
I hope not too many scripts rely on the OO model used there, because if they broke the simple example, they could as well have broken heavier code.
I still can't even get it to dump out the problem it has
Attach-PSScriptMethod
, where no loops exist at all.