Overview
RDSWeb Custom queries the RD Connection Broker to retrieve published RemoteApps and desktops for authenticated users. This is done via PowerShell and WMI (Windows Management Instrumentation).How It Works
When a user logs in, the backend:- Authenticates the user against Active Directory
- Executes a PowerShell script to query the RD Connection Broker
- Retrieves published applications using the
Win32_TSPublishedApplicationWMI class - Returns the application list to the frontend
Configuration
Set the RD Connection Broker server in your.env file:
Fully qualified domain name (FQDN) of the RD Connection Broker server.Example:
rdcb.contoso.localPowerShell Query
The backend executes this PowerShell command (seebackend/src/services/rdcbService.js:84-90):
WMI Class: Win32_TSPublishedApplication
This WMI class exposes published RemoteApps with the following properties:
| Property | Description | Example |
|---|---|---|
Name | Application display name | Microsoft Word 2019 |
Alias | Internal application alias | MSWORD |
VPath | Virtual path (launch path) | ||MSWORD |
IconPath | Path to the application icon | C:\Program Files\... |
FolderName | Organizational folder | Microsoft Office |
Required Permissions
The Node.js backend service account (the Windows user running the Node process) needs these permissions:1. WMI Namespace Permissions
Grant Read access to theroot\cimv2\TerminalServices namespace:
- Open Computer Management on the RD Connection Broker server
- Navigate to Services and Applications > WMI Control
- Right-click WMI Control > Properties
- Go to the Security tab
- Expand Root > CIMV2 > TerminalServices
- Click Security
- Add the service account and grant:
- Enable Account
- Remote Enable
- Read Security
2. DCOM Permissions
Enable remote DCOM access:- Run
dcomcnfg.exeon the RD Connection Broker - Navigate to Component Services > Computers > My Computer
- Right-click My Computer > Properties
- Go to the COM Security tab
- Under Access Permissions, click Edit Limits
- Add the service account and grant Remote Access
- Under Launch and Activation Permissions, click Edit Limits
- Add the service account and grant Remote Launch and Remote Activation
3. Firewall Rules
Allow WMI through Windows Firewall:- WMI (DCOM-In)
- WMI (WMI-In)
4. Local Security Policy
Ensure the service account is in one of these groups on the RDCB server:- Distributed COM Users
- Remote Management Users
Application Mapping
The service maps WMI data to the frontend format (seebackend/src/services/rdcbService.js:98-105):
Testing the Integration
Test PowerShell WMI access from the Node.js server:Error Handling
Error: “No se pudo contactar al RD Connection Broker”
This error occurs when the WMI query fails. Common causes:-
Network Connectivity: Verify the RDCB server is reachable
- WMI Permissions: Check the service account has WMI access (see Required Permissions)
- Firewall Rules: Ensure WMI traffic is allowed
-
PowerShell Execution Policy: Verify the backend server allows script execution
Timeout Issues
The WMI query has a 10-second timeout (seebackend/src/services/rdcbService.js:93):
- Check network latency to the RDCB server
- Reduce the number of published apps
- Consider caching the application list
RD Gateway Configuration
If users connect through an RD Gateway, configure it in.env:
Advanced: Remote Desktop Collections
For querying Remote Desktop collections (session-based desktops), use:The current implementation in
rdcbService.js:56-64 includes a SIMULATED_DESKTOPS array for desktop resources. You can extend the getAppsForUser function to query real desktop collections.Security Considerations
Recommendations
- Dedicated Service Account: Use a separate account for WMI queries (not the AD service account)
- Audit Logging: Enable WMI access logging on the RDCB server
- Network Segmentation: Restrict WMI access to specific source IPs
- Regular Review: Audit the service account permissions quarterly
Deployment Checklist
Related Pages
- Active Directory Setup - User authentication configuration
- Security Best Practices - Secure your deployment
- Simulation Mode - Test without a real RDCB