diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..63017d9 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,17 @@ +# Agent Instructions + +This is the standalone PrintMaster Scans utility. Read [README.md](README.md) for supported platforms, development, testing, and release deployment. The utility is `src/scans.ps1`; the root `scans.ps1` is the release loader, not the utility. + +## Keep the docs site in sync (required) + +- The canonical documentation lives in **Printmaster-Org/docs.printmaster.work**, normally checked out at `../docs.printmaster.work`. The main Scans guide is [content/scanning/printmaster-scans.md](../docs.printmaster.work/content/scanning/printmaster-scans.md), published at `/guides/scans/`. +- Review documentation impact for every feature, fix, removal, and deprecation. Changes to behavior, setup options, password handling, supported platforms, UI, loaders, or releases must update affected canonical pages in the same task. Keep this repository's README and deployment notes accurate too, without duplicating full guides. +- Follow the docs repository's [README](../docs.printmaster.work/README.md) for editing and validation. Link implementation and documentation commits or PRs, and report the updated pages and validation. Distinguish development changes from published releases: merging utility code does not deploy it to users. +- If no documentation change is needed, explicitly explain why. If the docs checkout is unavailable, report the blocker and exact pages needing updates; do not silently leave docs stale or report the task as complete. + +## Branches and pull requests (required) + +- `main` is protected. Make every change on a feature or fix branch and open a pull request; never commit or push directly to `main` or bypass branch protection. +- Use Conventional Commit subjects such as `fix(scans): retry rejected account passwords`. Include a `Docs:` reference to the paired docs commit or PR, or an explicit no-impact reason. +- Run the relevant tests described in the README before submitting. Keep machine-changing operations mocked in automated tests; validate real setup only on a disposable Windows VM. +- Do not publish a release or deploy the website unless explicitly requested. Follow [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for release and deployment changes. diff --git a/README.md b/README.md index e7cdeb9..e6e9ac8 100644 --- a/README.md +++ b/README.md @@ -97,9 +97,11 @@ When finished, copy the password and click Done. Windows can reject a scan-account password that does not meet the effective local or domain Group Policy requirements, even for a local account. A short, lowercase-only password may fail minimum-length or complexity rules. -If Windows reports `InvalidPassword` (or `net user` system error `2245` on older systems), setup displays a password-specific popup and remediation tip. It skips hiding the account, folder permissions, and SMB share configuration when account setup fails, and leaves **Copy Password** disabled so an unapplied password is not presented as usable. Independent steps, such as folder creation and network configuration, can still run. +If Windows reports `InvalidPassword` (or `net user` system error `2245` on older systems), setup pauses and returns to password entry. Enter a replacement or click **Generate**, then **Retry**. Account setup is retried before hiding the account, setting folder permissions, configuring the SMB share, or running any other remaining steps. Your other setup choices are preserved. If Windows rejects another password, you can edit or generate one and retry again. -Run setup again with the generated password or a longer password containing uppercase and lowercase letters, numbers, and symbols, without the username. Generated passwords are not guaranteed to satisfy every policy. If the password is still rejected, ask your administrator for the effective minimum length, complexity, history, and any additional restrictions rather than disabling the policy. +Choosing **Cancel setup** or closing the password dialog stops the remaining setup steps and leaves **Copy Password** disabled. After a successful retry, setup continues normally and copies only the accepted password when requested. + +Use the generated password or a longer password containing uppercase and lowercase letters, numbers, and symbols, without the username. Generated passwords are not guaranteed to satisfy every policy. If the password is still rejected, ask your administrator for the effective minimum length, complexity, history, and any additional restrictions rather than disabling the policy. ### Other setup errors diff --git a/src/scans.ps1 b/src/scans.ps1 index e4d9b18..5ee696a 100644 --- a/src/scans.ps1 +++ b/src/scans.ps1 @@ -49,7 +49,7 @@ $script:Remediation = @{ TrustRelation = "The domain trust is broken. Run the following from an admin prompt:`nTest-ComputerSecureChannel -Repair -Credential (Get-Credential)`nOr rejoin the machine to the domain." AccessDenied = "The current user does not have permission. Ensure you are running as Administrator and the folder is not read-only." ShareInUse = "Close any open files or Explorer windows pointing to the share, then try again." - PasswordPolicy = "Run setup again and use the generated password or enter a longer password with uppercase and lowercase letters, numbers, and symbols. Avoid including the username.`nLocal or domain Group Policy can enforce minimum length, complexity, password history, or additional restrictions. The generated password is not guaranteed to meet every policy. If it is still rejected, ask your administrator for the effective password requirements; do not disable the policy." + PasswordPolicy = "Use Generate or enter a longer password with uppercase and lowercase letters, numbers, and symbols, then retry. Avoid including the username.`nLocal or domain Group Policy can enforce minimum length, complexity, password history, or additional restrictions. The generated password is not guaranteed to meet every policy. If it is still rejected, ask your administrator for the effective password requirements; do not disable the policy." } # --- Preflight checks --- @@ -837,12 +837,58 @@ function Show-StepResult($result) { $message = "$($result.Message)`n`n$($result.Error)" if ($result.ErrorId -match 'InvalidPassword') { $title = 'Scan Account Password Rejected' - $message = "Windows rejected the password for the scan account. It may not meet the effective local or domain password policy.`n`nAccount-dependent steps will be skipped, and the rejected password will not be offered for copying." + $message = "Windows rejected the password for the scan account. It may not meet the effective local or domain password policy." } Show-ErrorPopup -Owner $script:progressWindow -Title $title -Message $message -Remediation $tip } } +function Show-PasswordRetryDialog { + param([string]$ErrorText) + + [xml]$passwordRetryXaml = @" + +$($script:themeResources) + + + + + + +