I need to run ps scripts from my java code in order to set performance monitor counters value.
For that I use the following line:
final String PS_COMMAND = "Powershell.exe -executionpolicy Unrestricted -File .\\myscript.ps1";
The problem is, that unless I first run the script from the ISE, it wouldn't set the counter value from the code, and from my perspective, the script simply won;t execute or is not usefull from the java code.
How can I fix this stauts?