简短摘要 - 即使Teamcity代理安装在我的凭证下运行,看起来仍然像使用权限较低的帐户一样运行。PowerShell脚本在TeamCity中的行为不同
构建代理服务被设置为使用我的凭据运行,我可以在服务小程序中看到它。
该版本有一个简单的powershell脚本,它使用IE COM对象在IE中加载页面。
$IE=new-object -com internetexplorer.application
$IE.visible=$true
$IE.navigate2("https://myurl.com/location")
我也有映射一个单独的命令脚本的网络驱动器到WebDAV位置。
NET USE Y: https://myurl.com/location
这两者都可以在命令行中正常运行。
我已确认该脚本我的帐户 下执行由在PowerShell中运行
echo $([Environment]::UserName)
,并使用
WHOAMI的驱动器映射脚本
命令。
为PowerShell中我得到的错误
new-object : Retrieving the COM class factory for component with CLSID
{0002DF01-0000-0000-C000-000000000046} failed due to the following error:
80080005 Server execution failed (Exception from HRESULT: 0x80080005
(CO_E_SERVER_EXEC_FAILURE)).
At line:1 char:5
$IE=new-object -com internetexplorer.application
CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
的驱动器映射脚本,我得到
"The system cannot find the drive specified."
注意我也试着运行NET USE作为脚本的一部分,看看有什么驱动器被映射,它不显示驱动器,即使我在运行脚本之前手动映射它。
是的,它做到了,现在可以看到并映射驱动器,PowerShell脚本创建浏览器时没有问题。 – TygerKrash