Automatic PowerShell Module Synchronization for Devolutions Agent Script Execution

Automatic PowerShell Module Synchronization for Devolutions Agent Script Execution

2 votes

avatar

Today PowerShell Universal allows scripts to be executed through the Devolutions Agent.
However, when scripts depend on custom or third-party PowerShell modules, administrators must manually ensure that all required modules are installed on every endpoint where the agent executes.
It would be very beneficial to have native support for automatic module deployment and version management between PowerShell Universal and Devolutions Agents.

Proposed Solution
Add a capability in PowerShell Universal to associate one or more modules from the repository's Modules folder with a script as Required Modules.

Script Configuration
Within a PSU script, provide a configuration option such as:
Required Modules:
- Az.Accounts (2.17.0)
- VMware.PowerCLI (13.3.0)
- CustomCompanyModule (1.5.2)

The modules would be linked directly from the PSU repository's Modules directory.

Agent Execution Workflow
When a script is executed through a Devolutions Agent:

  1. PSU checks the list of required modules for the script.
  2. The agent verifies whether each module exists locally in: C:\Windows\SystemTemp\PowerShellUniversal\Repository\Modules
  3. For each required module:
    • If the module does not exist, copy it from PSU to the agent.
    • If the module exists but the version is older than the required version, update it.
    • If the module exists and the version matches or is newer, no action is required.
  4. Once all module requirements are satisfied, execute the script.


Benefits

  • Eliminates manual module management on agent systems.
  • Ensures script portability across all agents.
  • Reduces script failures caused by missing modules.
  • Guarantees version consistency between PSU and agents.


All Comments (1)

avatar

@jol Thanks. This makes sense. We do have the ability to ship modules to agents via environments. If you configure an environment and then set the Modules to Import, select Virtual and then run that script on an agent in that environment, the modules will be sent down to the agent that are listed.

We currently do not have a way to send modules configured for just a single script.

Adam Driscoll
PowerShell Expert and Software Architect at Devolutions