Configurable user-profile loading: WINRS_NOPROFILE is hardcoded (winrs -noprofile)

Open
#139 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
java

Research direction

Start at Envelopes.createShell and trace the existing working-directory pinning and shell recreation flow. Then inspect the command and shell CLI parsing, plus commands.md and cli.md, and add or update tests for the Create option, pinned replay, and CLI behavior. Done means profile loading remains off by default, can be requested per shell, replays after recreation, and its non-admin failure is documented.

Written by the indexing model from the issue text.

Description

winrs parity: -nop[rofile] — except our polarity is reversed: winrs loads the profile by default and -noprofile turns it off; this client hardcodes WINRS_NOPROFILE=TRUE in the shell Create options, so the profile is never loaded and there is no way to ask for it.

Context

Envelopes.createShell always sends:

<wsman:Option Name="WINRS_NOPROFILE">TRUE</wsman:Option>

That is the safe default — winrs's load-the-profile default fails for users who are not local administrators on the target — but some commands genuinely need the user profile (HKCU hive, %APPDATA%, per-user PATH), and today they cannot have it.

Proposed API

CommandResult result = client.command("reg query HKCU\Software\...")
    .loadUserProfile()          // shell-scoped, like workingDirectory: first command pins it
    .execute();

Keep NOT loading the profile as the default — it is both the current behavior and the choice that works for non-admin users.

CLI

--profile on command (and shell, #136):

winrm-java -h server -u 'DOMAIN\user' -pf pw.txt --profile exec 'echo %APPDATA%'

Requirements

  • Shell-scoped setting with the same pinning semantics as the working directory (replayed with its original value when a reaped shell is silently recreated).
  • Document the failure mode: requesting the profile as a non-admin typically faults — the fault surfaces through the normal WinRMFaultException path with its code and detail.
  • Tests: wire assertion of the option value on Create, pinned replay on recreation, CLI parsing; docs (commands.md + cli.md).

🤖 Generated with Claude Code

Dominant language
Java
Stars
11
Forks
4
Avg merge
5d 5h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MetricsHub/winrm-java

All issues in MetricsHub/winrm-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.