Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从devops执行脚本时,Powershell模块不可见_Powershell_Azure Devops_Self Hosting_Azure Devops Self Hosted Agent - Fatal编程技术网

从devops执行脚本时,Powershell模块不可见

从devops执行脚本时,Powershell模块不可见,powershell,azure-devops,self-hosting,azure-devops-self-hosted-agent,Powershell,Azure Devops,Self Hosting,Azure Devops Self Hosted Agent,我编写了一个PowerShell脚本,该脚本在项目生成终止后使用ReportingServicesTools将报表部署到PowerBI报表服务器。以本人身份登录到服务器并执行脚本时,成功导入模块并执行脚本 当我使用Powershell任务在Azure DevOps发布管道中执行目标脚本时,返回以下错误: 导入模块:未找到指定的模块“ReportingServicesTools” 已加载,因为在任何模块目录中都找不到有效的模块文件。 位于D:\DevOps Agent\DeploySSRS2.ps

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

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

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

我们在发布和构建中使用自托管代理,服务器上安装了PS5

我试过:

  • 如MSDN所述,将模块移动到C:\Program Files\WindowsPowerShell\Modules中,这将使模块对所有用户可见
  • 将模块添加到C:\Windows\system32\WindowsPowerShell\v1.0\Modules中
  • 引用整个路径,而不仅仅是脚本中的模块名称

[1]是运行脚本的帐户在脚本运行位置可见的路径?///[2] 该帐户看到的
$env:PSModulePath
的值是多少?我比较了文件夹Active directory(从devops执行时可以成功解析)和文件夹ReportingServices Tools之间的目录安全权限。不同之处在于ReportingServicesTools具有继承的权限和一个名为S-n-nn-n-n(其中n为整数)的附加组或用户,并且权限标记(尽管与其他文件夹相同)被灰显。因此。。。在Azure DevOps运行脚本时,脚本是否可以看到该路径?在脚本中时是否设置了模块路径?当时脚本中的模块路径是否有效?我从devops执行了Get ChildItem C:\Windows\System32\WindowsPowerShell\v1.0\Modules,它成功终止,返回了不包括ReportingServicesTools模块的文件夹列表,这表明该文件夹不可见。啊哈!现在有进展了。[grin]是时候开始研究正在使用的powershell配置文件以及任何其他差异来源了。我不知道该怎么做,tho。