Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fakoua/deno_winrm
deno_winrm is a Deno typescript client for the Windows Remote Management (WinRM) service. It allows you to invoke commands on target Windows machines using Deno.
https://github.com/fakoua/deno_winrm
deno winrm winrm-client winrm-connector winrm-service
Last synced: about 1 month ago
JSON representation
deno_winrm is a Deno typescript client for the Windows Remote Management (WinRM) service. It allows you to invoke commands on target Windows machines using Deno.
- Host: GitHub
- URL: https://github.com/fakoua/deno_winrm
- Owner: fakoua
- License: mit
- Created: 2024-01-05T03:44:41.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-26T20:12:12.000Z (10 months ago)
- Last Synced: 2024-10-09T06:59:19.846Z (about 1 month ago)
- Topics: deno, winrm, winrm-client, winrm-connector, winrm-service
- Language: TypeScript
- Homepage:
- Size: 84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fakoua_deno_winrm&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=fakoua_deno_winrm)
# deno_winrm
deno_winrm is a Deno typescript client for the Windows Remote Management (WinRM) service. It allows you to invoke commands on target Windows machines using Deno.## Examples:
### Without a context
Executing a command without a context, executes each command in a separate shell, the run command will get a shell, run the command then close the shell.```ts
import * as winrm from "https://deno.land/x/deno_winrm/mod.ts";const context = new winrm.WinRMContext({
username: "my_user",
password: "my_password",
}, "machine_name_or_ip");const result = await context.runCommand("ipconfig /all");
if (result.exitCode === 0) {
console.log(result.stdout);
} else {
console.log(result.stderr);
}
```### With context
Executing commands with context will run all the commands between openShell/closeShell within the same shell, the user should manually opens and close the shell.
Using context is faster and can be used with environment variables.```ts
import * as winrm from "https://deno.land/x/deno_winrm/mod.ts";
const context = new winrm.WinRMContext({username: "user", password: "P@as$"}, "host")
await context.openShell() // <- open a shell
let res = await context.runCommand("dir")
console.log(res.stdout)
res = await context.runCommand("date /t")
console.log(res.stdout)
await context.closeShell() // <- close the shell
```