As you might have noticed, Orchestrator can be a bit grumpy when it comes to running Powershell scripts. Some cmdlets will simply not load in a .Net Script Activity.
Running scripts in a .Net Script Activity is really nice, because we have the possibility to publish variables in the script directly to the data bus.
A way around this could be to run scripts remotely on another server or add: Powershell{ /script\ } around your script, but in both cases we loose the possibility to publish all variables to the data bus.
The Problem
Orchestrator runs all powershell scripts in powershell v2 and in 32-bit mode. We can simulate this by:
- Starting a Powershell (x86) console
- Loading version 2 by typing: powershell -version 2
- If we try to load the cmdlets: import-module activedirectory you will see it will fail to load with some strange errors
The Cause
Active Directory cmdlets are compiled using the .Net4 assemblies, and poweshell v2 will only load .Net2 by default.
You can verify this by typing: [Environment]::version in your powershell console. “Major” is the version of the currently loaded .Net assembly.
If you compare on a regular x64 powershell console, and in a x86 v2 console like the one we started in the section above, you will see the difference.
The Solution
Add the following REG_DWORD registry key on the Orchestrator server and set the value to 1, to make Powershell (x86) always load the latest .Net assemblies :
hklm\software\wow6432node\microsoft\.netframework\OnlyUseLatestCLR
Worked like a charm. Thank u very much! we’ve until now used painful workarounds to resolve this but now we can skipp this 🙂
Just a note on this. The presence of this key will stop Operations Manager Console installing on the server so ensure that this is present first before adding the key.
Will this affect current .net scripts and make them unable to run? Or will they continue to work as normal?
I guess that depends on what types of cmdlets you use in your other scripts, and how they will react, but other then that, no.
Worked like a charm. Thank you very much.
Really well written blog post! I shall definitely use some of the ideas
myself, you’re awesome. Do you do online seminars?
Seriously well written blog! I am going to definitely use somke of tthe ideas myself, you’re fantastic.
Do you do training?
Nonetheless, might I ask your form recommendation?
Sounds good. I’ll give this a try.
Quick question: Will this force the runbook to download/install .net4 assemblies each time a “Run Net Script Script” activity needs to import the Active Directory module?
She was clearly reading us all wrong. I imagine our immaculate outfits were throwing her off track — although our look was rather spoiled by the bruises on our legs from being bashed by those heavy cases.
https://www.betting33.com
Hilariously, we aligned ourselves with the dedicated backpackers who continued to shake their heads in disbelief every time we turned up at a new destination with luggage that only got heavier as we indulged in more shopping sprees.
https://www.syy577.com
Next up was Venice, our final stop. But our typically chaotic relationship with train timetables mean we missed a direct connection, opting instead to break up the journey with a few hours in Florence.
https://www.dok222.com
After a failed attempt at seeing Botticelli’s “The Birth of Venus”– the queue for the Uffizi Gallery was insane — we sheepishly returned to the station to await our train.
https://www.ccclub700.com
During the course of the trip, we’d been swapping bags while on the move for no particular reason, and being the useless travelers we were, we’d opted to keep both passports in the same bag.
https://www.hgame79.com
https://www.bbdd66.com/world 월드카지노
https://www.omgka.com/world 월드카지노
https://www.omgka.com/first 퍼스트카지노
https://www.omgka.com/theking 더킹카지노
https://www.omgka.com/super 슈퍼카지노
https://www.bbdd66.com/first 퍼스트카지노
https://www.omgab.com/merit 메리트카지노
https://www.omgab.com/world 월드카지노