We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello! I need to execute specific powershell command in Java as admin. It works fine, but doesn't return any output. This is my code:
static void runPowerShellScript(){ try (PowerShell powerShell = PowerShell.openSession("C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" )) { PowerShellResponse response = powerShell.executeCommand("Start-Process -FilePath \"powershell\" -Verb RunAs -ArgumentList 'dir'"); System.out.println("Script output:" + response.getCommandOutput()); } catch(PowerShellNotAvailableException ex) { System.out.println(ex); } }
Any ideas, how I can catch output from it?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello! I need to execute specific powershell command in Java as admin. It works fine, but doesn't return any output. This is my code:
Any ideas, how I can catch output from it?
The text was updated successfully, but these errors were encountered: