首页 > 解决方案 > 从 devops 执行脚本时,Powershell 模块不可见

问题描述

我编写了一个 PowerShell 脚本,它使用 ReportingServicesTools 在项目构建终止后将报表部署到 PowerBI 报表服务器。当以我自己的身份登录服务器并执行脚本时,模块成功导入并执行脚本。

当我使用 Powershell 任务在 Azure DevOps 发布管道中执行目标脚本时,返回以下错误:

import-module :未加载指定的模块“ReportingServicesTools”,因为在任何模块目录中都找不到有效的模块文件。在 D:\DevOps Agent\DeploySSRS2.ps1:3 char:1 import-module -Name ReportingServicesTools

我们正在为我们的发布和构建使用自托管代理,并且服务器安装了 PS 5。

我试过了:

标签: powershellazure-devopsself-hostingazure-devops-self-hosted-agent

解决方案


推荐阅读