librust-winrm

WinRM (Windows Remote Management) client library for Rust.
Features
- ✅ NTLM Authentication - Full support over HTTPS
- ✅ Command Execution - Run commands and PowerShell scripts
- ✅ File Transfer - Upload and download files
- ✅ Error Handling - Comprehensive error types
Installation
Add to Cargo.toml:
[dependencies]
librust-winrm = "0.1.0"
Usage Example
use librust_winrm::WinRMClient;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = WinRMClient::new(
"https://10.0.3.203:5986/wsman",
"administrator",
"password",
"ntlm",
true, None, )?;
let shell_id = client.open_shell()?;
let command_id = client.run_command(&shell_id, "whoami")?;
let (stdout, stderr, exit_code) = client.get_command_output(&shell_id, &command_id)?;
println!("Output: {}", stdout);
client.close_shell(&shell_id)?;
Ok(())
}
File Transfer
use librust_winrm::{WinRMClient, upload_file, download_file};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = WinRMClient::new()?;
let shell_id = client.open_shell()?;
upload_file(&mut client, &shell_id, "local.txt", "C:\\\\remote.txt")?;
download_file(&mut client, &shell_id, "C:\\\\file.txt", "./local.txt")?;
client.close_shell(&shell_id)?;
Ok(())
}
Documentation
Full API documentation: docs.rs/librust-winrm
License
GPL-3.0-or-later
MIT