简体   繁体   English

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

[英]How to run PowerShell task with admin privileges in Azure Devops pipeline

I am trying to create RamDisk in DevOps agent servers using PowerShell task from Pipeline.我正在尝试使用 Pipeline 中的 PowerShell 任务在 DevOps 代理服务器中创建 RamDisk。 The script can create the Ramdisk rive but unable to format and mount it.该脚本可以创建 Ramdisk 驱动器,但无法对其进行格式化和挂载。 Its giving error that it needs elevated prompt.它给出的错误是它需要提升提示。 How I can run PowerShell task with admin privileges in Azure DevOps pipeline如何在 Azure DevOps 管道中以管理员权限运行 PowerShell 任务

Since you add azure-devops-self-hosted-agent tag, I assume you are using a self-hosted build agent for build.由于您添加了azure-devops-self-hosted-agent标记,因此我假设您使用的是自托管构建代理进行构建。 Then you can try to update the build agent to run with an administrator account.然后您可以尝试更新构建代理以使用管理员帐户运行。

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.运行services.msc并查找代理。 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.相反,尝试重新配置代理并使用管理员帐户运行它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Azure DevOps PowerShell Pipeline 任务中添加带下划线的参数值 - How to add argument values with underscore in Azure DevOps PowerShell Pipeline task Azure DevOps 中的 PowerShell 任务中的管道变量是否可用? - Are pipeline variables available in PowerShell task in Azure DevOps? 在 Azure DevOps 管道中运行 Azure powershell 命令 - Run Azure powershell commands in Azure devops pipeline 如何捕获错误错误:权限不足,无法完成操作。 在 Powershell Azure Devops 管道中 - How to trap Error ERROR: Insufficient privileges to complete the operation. in Powershell Azure Devops Pipeline 如何通过 azure devops 发布管道中的 powershell 任务创建 azure 资源? - How to create a azure resource through powershell task in azure devops release pipeline? 在 Azure DevOps Powershell 管道任务中获取自己的服务主体名称 - Get own Service Principal Name in an Azure DevOps Powershell pipeline task 无法更新 azure devops 管道上的 powershell 任务版本 - cannot update the powershell task version on azure devops pipeline 如何在 DevOps 发布管道中的 Azure Powershell 任务中使用环境变量? - How can you use environment variables in an Azure Powershell task in a DevOps Release Pipeline? 如何在 Azure DevOps Azure Powershell 任务中启用 PowerShell 交互模式? - How to enable PowerShell Interactive mode in Azure DevOps Azure Powershell Task? 如何使用 PowerShell 任务 (git clone) 在 Azure DevOps Server 发布管道中运行 Git 命令 - How to run Git commands in Azure DevOps Server release pipeline using PowerShell tasks (git clone)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM