【问题标题】:TFS: Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."TFS:使用“2”参数调用“SetRight”的异常:“无法获取用户信息。”
【发布时间】:2017-10-22 04:27:56
【问题描述】:

我在 TFS 中有一个包含 2 个任务的发布定义。其中一个完美通过,而另一个抛出异常,尽管两者的配置非常相似。

任务配置成功:

CopyFile Task
Source: $(System.DefaultWorkingDirectory)/XXX Build Definition/drop
Machines $(WebServers)
Admin Login: server\user
Password: Password
Protocol: HTTP
Destination Folder: C:\DestFolder

Variables: WebServers: MyServer

失败的任务配置:

RunPowerShellOnRemoteComputer Task
Machines $(WebServers)
Admin Login: server\user
Password: Password
Protocol: HTTP

PowerShell Script: C:\...\script.ps1

Variables: WebServers: MyServer

在运行第二个任务时,我收到此异常:

使用“2”参数调用“SetRight”的异常:“无法获得 用户信息。” CategoryInfo :NotSpecified: (:) [], MethodInvocationException FullyQualifiedErrorId :Exception ---> System.Management.Automation.RemoteException:异常调用 带有“2”个参数的“SetRight”:“无法获取用户 信息。” --- 内部异常堆栈跟踪结束 --- 在 Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(字符串 errorContextMessage, Boolean writeResultToLog, Boolean isCancellable) 在 Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.InstallServiceInternal(字符串 serviceSourcePath,字符串 serviceName,字符串destinationFileName) 在 Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.InstallService(字符串 serviceSourcePath,字符串 serviceName,字符串destinationFileName) 在 Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.d__24.MoveNext() --->(内部异常 #0)System.Management.Automation.RemoteException:异常调用 带有“2”个参数的“SetRight”:“无法获取用户 信息。” ---> System.Management.Automation.RuntimeException:无法从 服务可执行路径 VisualStudioRemoteDeployer.exe 。咨询 下面的日志:使用“2”参数调用“SetRight”的异常:“可能 未获取用户信息。” CategoryInfo :NotSpecified: (:) [], MethodInvocationException FullyQualifiedErrorId :异常

--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable

输入) 在 System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(运行空间 rs,布尔型 performSyncInvoke) 在 System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(运行空间 rsToUse,布尔 isSync) 在 System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 输出,PSInvocationSettings 设置) 在 System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 输出,PSInvocationSettings 设置) 在 Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(字符串 [] 参数)

当我转到远程机器时,我成功地在 C:...\script.ps1 上执行了“Invoke-Expression”。

另外,我成功地从本地机器的 powerscript 控制台连接到远程机器。

任何建议表示赞赏。

【问题讨论】:

    标签: powershell tfs


    【解决方案1】:

    请在用户名变量中包含。如果不是域环境,应该是机器名。

    所以,只需尝试将 UPN 用户名格式更新为 DOMAIN\UsernameMACHINENAME\Username 格式。

    【讨论】:

    • 非常感谢!这立即奏效了。这很奇怪,但没有太多关于此的文档。看来这个人必须以某种方式知道它。
    • 另外,MACHINENAME 参数不能包含机器 FQDN,只能包含机器名称。
    【解决方案2】:

    检查 NetLogon Windows 服务

    我部署到的目标服务器报告了这个错误。根据Andy's answer,我已经将PowerShell on Target Machines 任务的用户名设置为使用完整的DOMAIN\Username

    原来机器的NetLogon服务在机器启动时没有正常启动,因为它运行在异常繁忙的VSphere集群上。

    重新启动计算机确保 NetLogon Windows 服务及其相关服务均已启动,然后重新部署成功。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-04
      • 1970-01-01
      • 1970-01-01
      • 2011-04-10
      相关资源
      最近更新 更多