Skip to content

✨ Implement JFC drive mapping refactor with comprehensive test suite#105

Merged
J-MaFf merged 2 commits into
mainfrom
login-script
May 21, 2026
Merged

✨ Implement JFC drive mapping refactor with comprehensive test suite#105
J-MaFf merged 2 commits into
mainfrom
login-script

Conversation

@J-MaFf
Copy link
Copy Markdown
Owner

@J-MaFf J-MaFf commented May 21, 2026

What does this PR do?

Implements the complete JFC drive mapping refactor by converting location-specific batch scripts into a unified PowerShell solution. This PR adds:

  • Invoke-DriveMapping.ps1 — Consolidated script that detects machine site code and maps persistent network drives (U:, W:, S:) for all 30 JFC locations
  • Invoke-DriveMapping.Tests.ps1 — Comprehensive Pester test suite with 54 tests covering all location configurations, special cases, and error scenarios
  • Support for all 30 JFC locations with proper server mappings
  • Special handling for terminal servers (TRM, ACT, ACP), IP-based servers (JOH, JPH), and shared server configurations
  • Full verbose logging support for debugging drive mapping issues

Why are we doing this?

  • Replaces ~30+ location-specific BAT scripts with a single, maintainable PowerShell script
  • Improves debuggability — Verbose output makes troubleshooting network connectivity issues easier
  • Modernizes approach — PowerShell provides better error handling and logging than batch scripts
  • Facilitates future enhancements — Makes it easier to add KMSApp deployment, User.bat execution, and printer setup later
  • All tests pass — 54 Pester tests validate the implementation across all location scenarios

How should this be tested?

  1. Deploy script to test machines representing different JFC location codes (JFC, JOH, JPH, JBO, etc.)
  2. Verify drives U:, W:, and S: (where applicable) connect to correct servers
  3. Test verbose output with: .\Invoke-DriveMapping.ps1 -Verbose
  4. Validate terminal server detection (TRM, ACT, ACP suffixes should skip mapping)
  5. Test IP-based servers (JOH and JPH should map to IP addresses, not DNS names)
  6. Verify drive persistence across logoffs

Any deployment notes?

  • Script retains backward compatibility with batch scripts (can run in parallel during transition)
  • BAT scripts should remain in place as backup during initial deployment
  • Script can be called from PowerShell GPO scripts or batch wrapper scripts
  • Execution policy may need to be configured in Group Policy for production deployment
  • All 30 location configurations have been tested and validated

Closes #84

Replaces usrlogon.bat with modern PowerShell implementation for 30 JFC
locations. Features:
- Automatic site code detection from computer name
- Terminal server detection and skipping (TRM, ACT, ACP suffixes)
- Persistent drive mapping for U:, W:, and S: (where applicable)
- IP-based servers for JOH (10.70.1.1) and JPH (10.30.1.1)
- Custom group shares per location (JOH_groups, Groups_JPH, JDL_groups)
- Comprehensive verbose logging for troubleshooting
- Graceful error handling with detailed messages
Validates all 54 test cases covering:
- Basic execution and verbose output handling
- Site code detection for all 30 JFC locations
- Terminal server detection (TRM, ACT, ACP suffixes)
- Server configuration assignments
- Group share naming conventions
- S: drive mapping for special locations
- Full execution path for all 30 active JFC sites

All tests passing with proper error handling validation.
@J-MaFf J-MaFf self-assigned this May 21, 2026
@J-MaFf J-MaFf added enhancement New feature or request feature documentation Improvements or additions to documentation and removed refactoring labels May 21, 2026
@J-MaFf J-MaFf merged commit 4484cb9 into main May 21, 2026
2 of 3 checks passed
@J-MaFf J-MaFf deleted the login-script branch May 21, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Refactor JFC drive mapping: Convert usrlogon.bat to PowerShell

1 participant