WinRM Client

A WinRM library for Java

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

io.cloudsoft.windows
ArtifactId

ArtifactId

winrmj4-client
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

WinRM Client
A WinRM library for Java

Download winrmj4-client

How to add to project

<!-- https://jarcasting.com/artifacts/io.cloudsoft.windows/winrmj4-client/ -->
<dependency>
    <groupId>io.cloudsoft.windows</groupId>
    <artifactId>winrmj4-client</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.cloudsoft.windows/winrmj4-client/
implementation 'io.cloudsoft.windows:winrmj4-client:0.2.0'
// https://jarcasting.com/artifacts/io.cloudsoft.windows/winrmj4-client/
implementation ("io.cloudsoft.windows:winrmj4-client:0.2.0")
'io.cloudsoft.windows:winrmj4-client:jar:0.2.0'
<dependency org="io.cloudsoft.windows" name="winrmj4-client" rev="0.2.0">
  <artifact name="winrmj4-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.cloudsoft.windows', module='winrmj4-client', version='0.2.0')
)
libraryDependencies += "io.cloudsoft.windows" % "winrmj4-client" % "0.2.0"
[io.cloudsoft.windows/winrmj4-client "0.2.0"]

Dependencies

provided (1)

Group / Artifact Type Version
io.cloudsoft.windows : winrm4j-service jar 0.2.0

test (1)

Group / Artifact Type Version
org.testng : testng jar 6.8.8

Project Modules

There are no modules declared in this project.

winrm4j

winrm4j is a project which enables Java applications to execute batch or PowerShell commands on a remote Windows server using WinRM

You can download the latest binaries here, 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:

mvn clean install

Maven dependency

Add the following to your pom.xml:

<dependency>
  <groupId>io.cloudsoft.windows</groupId>
  <artifactId>winrm4j</artifactId>
  <version>0.12.0-SNAPSHOT</version> <!-- WINRM4J_VERSION -->
</dependency>

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<String,String>)
  • 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<String>) execute a list of commands concatenated with &
  • executePs(String) execute a PowerShell command with the native windows command
  • executePs(List<String>) execute a list of PowerShell commands
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. See the contacts page 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.

io.cloudsoft.windows

Cloudsoft

Business Evolution in the Cloud

Versions

Version
0.2.0