Skip to content

Commit

Permalink
Add powershell command
Browse files Browse the repository at this point in the history
  • Loading branch information
fakoua committed Jan 9, 2024
1 parent d732abd commit f6ac5a7
Show file tree
Hide file tree
Showing 6 changed files with 556 additions and 385 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"deno.lint": true,
"deno.unstable": false,
"cSpell.words": [
"commandid"
"commandid",
"encodedcommand"
]
}
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const context = new winrm.WinRMContext({

const result = await context.runCommand("ipconfig /all");

if (result.success) {
console.log(result.message);
if (result.exitCode === 0) {
console.log(result.stdout);
} else {
console.log(result.error?.message);
console.log(result.stderr);
}
```

Expand All @@ -33,7 +33,8 @@ 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.message)
console.log(res.stdout)
await context.closeShell() // <- close the shell
```
Loading

0 comments on commit f6ac5a7

Please sign in to comment.