Skip to content

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

@J-MaFf

Description

@J-MaFf

What does this PR do?

Consolidate drive mapping logic from ~30 location-specific BAT scripts into a single PowerShell script (Invoke-DriveMapping.ps1). The script will:

  • Detect machine site code from computer name prefix
  • Look up UserServer, GroupServer, and additional drive mappings from a configuration hashtable
  • Map persistent network drives (U:, W:, and S: where applicable) for all 30 JFC locations
  • Support -Verbose flag for debugging
  • Handle special cases (terminal servers, IP-based servers, duplicate site handlers)

Why are we doing this?

  • Maintainability: Single script vs. 30+ BAT files with redundant if-statements
  • Modern approach: PowerShell provides better error handling, logging, and string manipulation than batch
  • Future-proofing: Easier to extend functionality (KMSApp deployment, User.bat execution, printer setup) later
  • Debugging: Verbose logging will aid troubleshooting connectivity issues

JFC Location & Drive Mapping Configuration

Site Code Location UserServer GroupServer W: Share Notes
IDC Data Center IDCS6BDC01 IDCS6BDC01 \Groups Standard
JAT Atlanta (Alt) JATS2BDC02 JATS2BDC02 \Groups Standard
JBO Boise JBOS2BDC01 JBOS2BDC01 \Groups S: → \10.80.1.1\Groups
JBR Baton Rouge JBRS2BDC01 JBRS2BDC01 \Groups Standard
JBT Boston JBTS2BDC02 JBTS2BDC02 \Groups Standard
JCH Chicago JCHS9BDC02 JCHS9BDC02 \Groups Standard
JDE Denver JDES2BDC02 JDES2BDC02 \Groups Standard
JDL Dallas JHTS9BDC01 JHTS9BDC01 \JDL_groups S: → \10.50.1.1\Groups
JFC Kansas City JFCS8BDC01 JFCS8BDC01 \Groups Standard (default)
JFH Hawaii JHIS2BDC02 JHIS2BDC02 \Groups Shares Hawaii servers
JHI Hawaii JHIS2BDC02 JHIS2BDC02 \Groups Same as JFH
JHO Houston JHOS2BDC01 JHOS2BDC01 \Groups Standard
JHP Phoenix 10.30.1.1 10.30.1.1 \Groups_JPH IP-based, custom share
JHT Atlanta JHTS9BDC01 JHTS9BDC01 \Groups Standard
JLA Los Angeles JLAS2BDC01 JLAS2BDC01 \Groups Standard
JLV Las Vegas JLVS2BDC01 JLVS2BDC01 \Groups Standard
JMI Miami JMIS2BDC01 JMIS2BDC01 \Groups Standard
JMX Mexico JMXS6BDC01 JMXS6BDC01 \Groups Standard
JNY New York JNYS6BDC01 JNYS6BDC01 \Groups Standard
JOH Ohio 10.70.1.1 10.70.1.1 \JOH_groups IP-based, custom share
JOR Orlando JMIS2BDC01 JMIS2BDC01 \Groups Uses JMI servers
JPH Phoenix 10.30.1.1 10.30.1.1 \Groups_JPH IP-based, custom share
JPM California (PMAI) JPMS6BDC01 JPMS6BDC01 \Groups PMAI shared server
JPN New York (PMAI) JPMS6BDC01 JPMS6BDC01 \Groups PMAI - uses JPM servers
JPS San Francisco (PMAI) JPMS6BDC01 JPMS6BDC01 \Groups PMAI - uses JPM servers
JPV Vancouver (PMAI) JPVS2BDC01 JPVS2BDC01 \Groups PMAI Canada
JSA San Antonio JSFS9BDC01 JSFS9BDC01 \Groups Standard
JSD San Diego JSDS9BDC01 JSDS9BDC01 \Groups Standard
JSE Seattle JSES9BDC01 JSES9BDC01 \Groups Standard
JSF San Francisco JSFS9BDC01 JSFS9BDC01 \Groups Standard

Drive Mapping Details

All locations map:

  • U: drive\\{UserServer}\{username}$ (user home directory)
  • W: drive\\{GroupServer}\{share} (group directory - see table for share name)

Special S: Drive Mappings:

  • JBO: S: → \10.80.1.1\Groups
  • JDL: S: → \10.50.1.1\Groups

IP-Based Servers (non-DNS dependent):

  • JOH: All mappings use 10.70.1.1
  • JPH: All mappings use 10.30.1.1

Shared Server Configurations:

  • PMAI (JPM/JPN/JPS): All three locations use JPMS6BDC01
  • Hawaii (JFH/JHI): Both use JHIS2BDC02
  • JOR: Uses JMIS2BDC01 (Miami servers)
  • JDL: Uses JHTS9BDC01 (Atlanta servers)

Special Cases

  • Terminal Servers (TRM, ACT, ACP): Skip drive mapping
  • JPMS2SAG: PMAI Sage server — skip drive mapping
  • IP-based servers: JOH (10.70.1.1), JPH (10.30.1.1)
  • Duplicate handlers: JFH/JHI, JPN/JPS/JPM, JOR/JMI, JDL/JHT, JWM/JHO

How should this be tested?

  1. Deploy script to a test machine representing each of the 30 JFC locations
  2. Verify drives U:, W:, and S: (where applicable) connect to correct servers
  3. Test -Verbose flag output for completeness
  4. Verify persistence across logoffs
  5. Test special cases:
    • Terminal servers (TRM, ACT, ACP) — should skip
    • IP-based servers (JOH, JPH)
    • Duplicate site handlers (JFH/JHI, JPN/JPS/JPM, JOR/JMI, JDL/JHT, JWM/JHO)
    • Custom group shares (JOH_groups, Groups_JPH, JDL_groups)

Any deployment notes?

  • Script will eventually replace usrlogon.bat; BAT files retained for now as backup
  • Execution via PowerShell call from batch (or direct GPO script later)
  • May require execution policy configuration in Group Policy

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions