Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudsoft/winrm4j
https://github.com/cloudsoft/winrm4j
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cloudsoft/winrm4j
- Owner: cloudsoft
- License: apache-2.0
- Created: 2015-03-23T15:08:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-21T15:30:56.000Z (over 1 year ago)
- Last Synced: 2024-08-01T19:45:42.562Z (3 months ago)
- Language: Java
- Size: 620 KB
- Stars: 93
- Watchers: 22
- Forks: 52
- Open Issues: 62
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# winrm4j
`winrm4j` is a project which enables Java applications to execute batch or PowerShell commands on a remote Windows server
using [WinRM](https://msdn.microsoft.com/en-us/library/aa384426(v=vs.85).aspx)You can download the latest binaries [here](http://mvnrepository.com/artifact/io.cloudsoft.windows/winrm4j), which also gives the details
for adding winrm4j as a dependency to your project.If you wish to build the binaries yourself, you can clone this project, and build it using [Maven](https://maven.apache.org/):
`mvn clean install`
### Maven dependency
Add the following to your `pom.xml`:
```
io.cloudsoft.windows
winrm4j
0.13.0-SNAPSHOT```
### Java client usage
To use winrm4j in Java code, you first create a `WinRmTool` object via the static `WinRmTool.Builder` class.
`WinRmTool.Builder` has several options which you might consider setting before instantiating a `WinRmTool`:* `workingDirectory(String)`
* `environment(Map)`
* `authenticationScheme(String)`
* `disableCertificateChecks(boolean)`
* `useHttps(boolean)`
* `port(int)`A `WinRmTool` instance supports the basic `executeCommand(String)` method which executes windows native commands.
Through `executeCommand(String)` method supports:* `executeCommand(List)` execute a list of commands concatenated with &
* `executePs(String)` execute a PowerShell command with the native windows command
* `executePs(List)` execute a list of PowerShell commands``` java
WinRmClientContext context = WinRmClientContext.newInstance();WinRmTool tool = WinRmTool.Builder.builder("my.windows.server.com", "Administrator", "pa55w0rd!")
.authenticationScheme(AuthSchemes.NTLM)
.port(5985)
.useHttps(false)
.context(context)
.build();tool.executePs("echo hi");
context.shutdown();
```### Contacts
Commercial support for the library is provided as part of [Cloudsoft AMP](https://cloudsoft.io/products/). See the [contacts page](https://cloudsoft.io/support) for the various ways to contact us.
### License
Copyright 2015-2019 by Cloudsoft Corporation Limited
> Licensed under the Apache License, Version 2.0 (the "License");
> you may not use this file except in compliance with the License.
> You may obtain a copy of the License at
>
> http://www.apache.org/licenses/LICENSE-2.0
>
> Unless required by applicable law or agreed to in writing, software
> distributed under the License is distributed on an "AS IS" BASIS,
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> See the License for the specific language governing permissions and
> limitations under the License.