powershell - 如何在 Azure Devops 管道中以管理员权限运行 PowerShell 任务

标签 powershell azure-devops azure-devops-self-hosted-agent

我正在尝试使用 Pipeline 中的 PowerShell 任务在 DevOps 代理服务器中创建 RamDisk。该脚本可以创建 Ramdisk 驱动器,但无法对其进行格式化和挂载。它给出的错误是它需要提升提示。
如何在 Azure DevOps 管道中以管理员权限运行 PowerShell 任务

最佳答案

既然你加了 azure-devops-self-hosted-agent标记,我假设您正在使用自托管构建代理进行构建。然后您可以尝试更新构建代理以使用管理员帐户运行。

If you configured the agent to run as a service, it starts automatically. You can view and control the agent running status from the services snap-in. Run services.msc and look for the agent. If you need to change the agent's logon account, don't do it from the Services snap-in. Instead, try to re-configure the agent and run it with an administrator account.

关于powershell - 如何在 Azure Devops 管道中以管理员权限运行 PowerShell 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64669465/

相关文章:

node.js - 如何从 package.json "scripts"执行 powershell ps1 脚本?

.net - 使用 System.Xml.XmlDocument 解析 vcxproj

azure - 如何安全地存储连接字符串客户端 ID 等?

Azure 和 AzureRM Powershell 模块冲突

azure - 在Azure自托管中插入PAT后找不到可用的libssl版本

azure - 自托管 MacOS 代理上的 DevOps 管道在 NuGet 包还原上失败,但在 Azure Pipeline 上运行

powershell - Win10 : How to activate developer mode using powershell or cmd. exe?

Powershell修改Web.config mailSettings

visual-studio - 您不能在 '' 处创建分支,因为 '' 处已经存在一个分支。如果 '' 不是分支,则将其转换回文件夹并重试该操作

azure - Powershell 任务中设置 $var 'The term ' keyVaultName' 时出错,未被识别为 cmdlet 的名称”