Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8a2910c
Add repository hygiene files
christaylorcodes Nov 10, 2026
feb11db
Route API calls through one request helper; fix cookies, logging and …
christaylorcodes Nov 10, 2026
44f7d18
Add session functions that work on both connection types
christaylorcodes Nov 10, 2026
a8a22a5
Fix Remote Workforce functions against the extension source
christaylorcodes Nov 10, 2026
6e1d32e
Add unit tests and a live smoke test
christaylorcodes Nov 10, 2026
fd0cddb
Bump version to 0.5.0.0; update changelog, readme and contributor notes
christaylorcodes Nov 10, 2026
6e3a438
Clean up stale files and fix the redundant-session example
christaylorcodes Nov 10, 2026
e2063cc
Regenerate markdown and MAML help
christaylorcodes Nov 10, 2026
beae4c3
Fix review findings: ignored source file, retry/error handling, examp…
christaylorcodes Nov 10, 2026
b29acdf
Bring Remove-CWCHostFromSession (#28) to module conventions
christaylorcodes Nov 10, 2026
2b9b388
Add Remove-CWCSessionNote, based on #27
christaylorcodes Nov 10, 2026
13fffe3
Add Enter-CWCSession to open the Host client for a session (#13)
christaylorcodes Nov 10, 2026
1e8a064
Refresh help after folding in Enter-CWCSession
christaylorcodes Nov 10, 2026
43882a1
Simplify: shared session-event helper, typed errors, lookup tables
christaylorcodes Nov 10, 2026
0e9bc42
Simplify: help build script, derived test lists, narrower .gitignore
christaylorcodes Nov 10, 2026
9493e78
Fix review round 1 findings; add help to touched functions
christaylorcodes Nov 10, 2026
a352a4e
Fix review round 2 findings
christaylorcodes Nov 10, 2026
c8fdc6c
Fix review round 3 findings
christaylorcodes Nov 10, 2026
601abc1
Smoke test: record event IDs, check wrong-password handling
christaylorcodes Nov 10, 2026
e89bbb7
Smoke test: test only this checkout's module
christaylorcodes Nov 10, 2026
59407b8
API-secret note/message/toolbox: no output; document RESTfulUserName
christaylorcodes Nov 10, 2026
274bd84
MFA login for Connect-CWC (#12)
christaylorcodes Nov 10, 2026
e489835
MFA review fixes: null code, login leaks, probe errors, TOTP step
christaylorcodes Nov 10, 2026
0ff924c
TOTP secret: accept otpauth:// links and any type prefix
christaylorcodes Nov 10, 2026
559d0c2
Smoke test: TOTP login with a temporary user (-TotpTestRole)
christaylorcodes Nov 10, 2026
df852cd
Move CI to GitHub Actions and align repo files with GitHub-Template
christaylorcodes Nov 10, 2026
3f53d8f
test-local: discover the module manifest instead of hard-coding its name
christaylorcodes Nov 10, 2026
fabc4d1
Adopt the GitHub-Template source/ layout and Sampler build
christaylorcodes Nov 10, 2026
d9b774d
Use the ScreenConnect product name; keep the module and command names
christaylorcodes Nov 11, 2026
cadd017
CHANGELOG: keep 0.5.0 under Unreleased until it is published
christaylorcodes Nov 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions .PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
@{
# Severity levels: Error, Warning, Information
Severity = @('Error', 'Warning')

IncludeRules = @(
# Code Style
'PSAvoidDefaultValueForMandatoryParameter',
'PSAvoidDefaultValueSwitchParameter',
'PSAvoidGlobalVars',
'PSAvoidUsingCmdletAliases',
'PSAvoidUsingComputerNameHardcoded',
'PSAvoidUsingConvertToSecureStringWithPlainText',
'PSAvoidUsingDeprecatedManifestFields',
'PSAvoidUsingEmptyCatchBlock',
'PSAvoidUsingInvokeExpression',
'PSAvoidUsingPlainTextForPassword',
'PSAvoidUsingPositionalParameters',
'PSAvoidUsingUsernameAndPasswordParams',
'PSAvoidUsingWMICmdlet',
'PSAvoidUsingWriteHost',

# Best Practices
'PSAlignAssignmentStatement',
'PSAvoidAssignmentToAutomaticVariable',
'PSAvoidLongLines',
'PSAvoidOverwritingBuiltInCmdlets',
'PSAvoidShouldContinueWithoutForce',
'PSAvoidTrailingWhitespace',
'PSAvoidUsingBrokenHashAlgorithms',
'PSAvoidUsingDoubleQuotesForConstantString',

# Functions
'PSAvoidMultipleTypeAttributes',
'PSMisleadingBacktick',
'PSMissingModuleManifestField',
'PSPlaceCloseBrace',
'PSPlaceOpenBrace',
'PSProvideCommentHelp',
'PSReservedCmdletChar',
'PSReservedParams',
'PSReviewUnusedParameter',
'PSShouldProcess',
'PSUseApprovedVerbs',
'PSUseBOMForUnicodeEncodedFile',
'PSUseCmdletCorrectly',
'PSUseCompatibleCmdlets',
'PSUseCompatibleSyntax',
'PSUseCompatibleTypes',
'PSUseConsistentIndentation',
'PSUseConsistentWhitespace',
'PSUseCorrectCasing',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUseLiteralInitializerForHashtable',
'PSUseOutputTypeCorrectly',
'PSUsePSCredentialType',
'PSUseProcessBlockForPipelineCommand',
'PSUseShouldProcessForStateChangingFunctions',
'PSUseSingularNouns',
'PSUseSupportsShouldProcess',
'PSUseToExportFieldsInManifest',
'PSUseUTF8EncodingForHelpFile',
'PSUseUsingScopeModifierInNewRunspaces'
)

Rules = @{
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $true
NewLineAfter = $true
IgnoreOneLineBlock = $true
}

PSPlaceCloseBrace = @{
Enable = $true
NewLineAfter = $false
IgnoreOneLineBlock = $true
NoEmptyLineBefore = $false
}

PSUseConsistentIndentation = @{
Enable = $true
Kind = 'space'
PipelineIndentation = 'IncreaseIndentationForFirstPipeline'
IndentationSize = 4
}

PSUseConsistentWhitespace = @{
Enable = $true
CheckInnerBrace = $true
CheckOpenBrace = $true
CheckOpenParen = $true
CheckOperator = $true
CheckPipe = $true
CheckPipeForRedundantWhitespace = $false
CheckSeparator = $true
CheckParameter = $false
# Let PSAlignAssignmentStatement own hashtable alignment (otherwise aligned '=' is flagged here)
IgnoreAssignmentOperatorInsideHashTable = $true
}

PSAlignAssignmentStatement = @{
Enable = $true
CheckHashtable = $true
}

PSUseCorrectCasing = @{
Enable = $true
}

PSAvoidLongLines = @{
Enable = $true
MaximumLineLength = 120
}

# The module manifest says PowerShell 3.0 and MSPs run it on Windows PowerShell 5.1 (RMM agents).
# Build and test tooling runs on PowerShell 7, but the module itself must stay 3.0/5.1-compatible.
PSUseCompatibleSyntax = @{
Enable = $true
TargetVersions = @(
'3.0',
'5.1',
'7.6'
)
}

# PSUseCompatibleCommands is disabled because the PSSA compatibility
# profile catalog is often outdated.
# PSUseCompatibleCommands = @{
# Enable = $true
# TargetProfiles = @()
# }

PSProvideCommentHelp = @{
Enable = $true
ExportedOnly = $true
BlockComment = $true
VSCodeSnippetCorrection = $false
Placement = 'before'
}
}
}
84 changes: 84 additions & 0 deletions .build/required-modules.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Custom build task: verifies resolved build dependencies (loaded automatically by
# build.ps1 from the .build/ folder).
#
# Resolve-Dependency.ps1 only WARNS when Save-PSResource fails, and GitHub runners ship
# their own Pester/PSScriptAnalyzer. Without this check a bad or unavailable pin leaves
# the build silently running on whatever version the machine happens to have.

function Test-VersionInRange {
<#
.SYNOPSIS
Tests a version against a NuGet-style range ('[1.0,2.0)'), an exact version, or 'latest'.
#>
param(
[Parameter(Mandatory)][version]$Version,
[Parameter(Mandatory)][string]$Range
)

if ($Range -eq 'latest') { return $true }

if ($Range -match '^\s*([\[\(])\s*([^,]*?)\s*,\s*([^\]\)]*?)\s*([\]\)])\s*$') {
$minInclusive = $Matches[1] -eq '['
$maxInclusive = $Matches[4] -eq ']'
$min = if ($Matches[2]) { [version]$Matches[2] } else { $null }
$max = if ($Matches[3]) { [version]$Matches[3] } else { $null }

if ($min -and ($(if ($minInclusive) { $Version -lt $min } else { $Version -le $min }))) { return $false }
if ($max -and ($(if ($maxInclusive) { $Version -gt $max } else { $Version -ge $max }))) { return $false }
return $true
}

# Exact version ('5.6.1' or '[5.6.1]')
return $Version -eq [version]($Range.Trim('[', ']', ' '))
}

# Synopsis: Fails if a required module is missing, has more than one version, or is outside its pinned range.
task Assert_RequiredModule_Versions {
$requiredModulesFile = Join-Path -Path $BuildRoot -ChildPath 'RequiredModules.psd1'
$requiredModulesDir = if ($RequiredModulesDirectory) { $RequiredModulesDirectory } else { Join-Path 'output' 'RequiredModules' }
$requiredModulesPath = Get-SamplerAbsolutePath -Path $requiredModulesDir -RelativeTo $BuildRoot

if (-not (Test-Path -Path $requiredModulesPath)) {
throw "Required modules folder '$requiredModulesPath' not found. Run './build.ps1 -ResolveDependency -Tasks noop'."
}

$requirements = Import-PowerShellDataFile -Path $requiredModulesFile
$problems = [System.Collections.Generic.List[string]]::new()

foreach ($name in ($requirements.Keys | Where-Object { $_ -ne 'PSDependOptions' } | Sort-Object)) {
$spec = $requirements[$name]
$range = if ($spec -is [hashtable]) { "$($spec.Version)" } else { "$spec" }
if (-not $range) { $range = 'latest' }

$moduleFolder = Get-ChildItem -Path $requiredModulesPath -Directory |
Where-Object Name -EQ $name |
Select-Object -First 1
if (-not $moduleFolder) {
$problems.Add("${name}: not found in $requiredModulesPath")
continue
}

$versions = @(Get-ChildItem -Path $moduleFolder.FullName -Directory |
Where-Object { $_.Name -as [version] } |
ForEach-Object { [version]$_.Name })

if ($versions.Count -ne 1) {
$problems.Add("${name}: expected exactly one version, found $($versions.Count) ($($versions -join ', '))")
continue
}

if (-not (Test-VersionInRange -Version $versions[0] -Range $range)) {
$problems.Add("${name}: version $($versions[0]) is outside the required range '$range'")
continue
}

Write-Build Green (" {0,-22} {1,-12} (required: {2})" -f $name, $versions[0], $range)
}

if ($problems.Count -gt 0) {
$problems | ForEach-Object { Write-Build Red " $_" }
throw ('Required module check failed. Delete output/RequiredModules and run ' +
"'./build.ps1 -ResolveDependency -Tasks noop' from a NEW PowerShell session.")
}
# (The template's Pester pre-load is omitted: this repo runs Pester through Tests/test-local.ps1, not Sampler.)
}
52 changes: 52 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# EditorConfig is awesome: https://EditorConfig.org

# Top-most EditorConfig file
root = true

# Default settings for all files
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

# Markdown files
[*.md]
# Markdown uses trailing spaces for line breaks
trim_trailing_whitespace = false
max_line_length = off

# YAML files (GitHub workflows, config files)
[*.{yml,yaml}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# XML files (MAML help, config)
[*.xml]
indent_size = 2

# PowerShell files
[*.{ps1,psm1,psd1}]
# EditorConfig does not allow inline comments after values.
# PowerShell prefers UTF-8 with BOM (Windows PowerShell reads BOM-less files as ANSI)
charset = utf-8-bom
indent_size = 4
# Windows line endings for PowerShell
end_of_line = crlf

# Batch files (Windows)
[*.{bat,cmd}]
end_of_line = crlf

# Documentation files
[*.{txt,rst}]
max_line_length = off

# License and changelog files
[{LICENSE,CHANGELOG,CONTRIBUTING,CODE_OF_CONDUCT,SECURITY}]
max_line_length = off
94 changes: 94 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Git Attributes Configuration
# https://git-scm.com/docs/gitattributes

# Set default behavior to automatically normalize line endings
* text=auto

###############################
# Text Files (Auto-normalize) #
###############################

# PowerShell
*.ps1 text eol=crlf diff=powershell
*.psm1 text eol=crlf diff=powershell
*.psd1 text eol=crlf
*.ps1xml text eol=crlf
*.pssc text eol=crlf
*.psrc text eol=crlf
*.cdxml text eol=crlf

# Scripts
*.bash text eol=lf
*.sh text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf

# Documentation
*.md text diff=markdown
*.txt text

# Config files
*.json text
*.yaml text
*.yml text
*.xml text
.editorconfig text
.gitattributes text
.gitconfig text
.gitignore text

# Special files
AUTHORS text
CHANGELOG text
CONTRIBUTING text
LICENSE text
README text

###############################
# Binary Files #
###############################

# Graphics
*.gif binary
*.ico binary
*.jpg binary
*.jpeg binary
*.png binary
*.webp binary
*.svg text

# Archives
*.7z binary
*.gz binary
*.tar binary
*.zip binary

# Executables
*.exe binary
*.dll binary

####################
# Merge Strategies #
####################

# For changelog files, prefer union merge
CHANGELOG* merge=union

####################
# Linguist #
####################

# Documentation
Docs/** linguist-documentation
*.md linguist-documentation

####################
# Export Ignore #
####################
# Files to exclude from export archives (git archive)

.gitattributes export-ignore
.gitignore export-ignore
.editorconfig export-ignore
.github export-ignore
Tests export-ignore
Loading
Loading