https://github.com/ow2-proactive/scriptengine-powershell
PowerShell script engine for Java
https://github.com/ow2-proactive/scriptengine-powershell
powershell script-engine scriptengine-powershell
Last synced: 12 days ago
JSON representation
PowerShell script engine for Java
- Host: GitHub
- URL: https://github.com/ow2-proactive/scriptengine-powershell
- Owner: ow2-proactive
- License: agpl-3.0
- Created: 2015-05-16T13:38:53.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-09-06T15:37:46.000Z (over 1 year ago)
- Last Synced: 2025-05-13T11:15:00.343Z (12 days ago)
- Topics: powershell, script-engine, scriptengine-powershell
- Language: C#
- Homepage:
- Size: 685 KB
- Stars: 1
- Watchers: 21
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scriptengine-powershell
PowerShell script engine for Java implementing JSR 223
## Requirements
* .NET 4
* Windows Management Framework 3.0## Usage
Simply add the JAR and DLLs to your classpath and follow the [Java Scripting Programmer's guide](http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html)
## Build
Run gradlew script, it produces JARs and DDLs in build/install
## How it works
It uses [jni4net](https://github.com/jni4net/jni4net) to call the PowerShell API.
### Bindings
Script bindings are exported in the PowerShell engine before running the script.
PowerShell supported types are: string, char, byte, int, long, bool, double, array, hashtable.
Java List are mapped to PowerShell array.
Java Map are mapped to PowerShell hashtable.The following types are NOT supported: single decimal datetime xml.
To pass arguments/parameters to a PowerShell ($args), you can set a binding called args.
### Script Result
Results produced by return or Write-Output are retrieved and converted back to Java.
### To update jni4net bindings
* Look at the `utils.proxygen.xml` file. It defines what proxies will be generated.
* Run `generateProxies.cmd`, it will generate
* Java proxies of .NET classes
* and C# codebe-hind classes
* Now you need to compile codebe-hind classes into assembly.
* Start Visual Studio,
* open `utils.csproj`
* eventually add newly generated files to the project
* compile it