The Run .Net Script runbook activity will always return "Success" because it doesn't know/care what actually runs inside, the issue is that the Run .Net Script
still runs a 32-bit instance of PowerShell and might still run PowerShell version 2, to run the native PowerShell version you can for example use the Invoke-Command
within a Run.Net Script
runbook activity and run your entire script within the Invoke-Command
.
For example:
Invoke-Command -ComputerName localhost -Scriptblock {
#Your Code
}
The code inside script block will run in a 64-bit PowerShell and it will also run the native PowerShell version.
Or you can use one of the methods that I have mentioned here:
https://thesystemcenterblog.com/wp-content/uploads/2018/05/Making-Orchestrator-to-use-native-powershell-version.pdf
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Best regards,
Leon