我尝试将 DLL 文件从我的计算机复制到另一台计算机并注册它:
net use \\RemoteIp\C$\Dev 'pass'/USER:'user'
复制项“D:\test.dll”-目标“\\RemoteIp\c$\Dev”;
regsvr32 "\\RemoteIp\C$\Dev\test.dll"
我遇到的问题是,当我尝试从 Octopus 运行此脚本时,我收到此错误:
Copy-Item : Cannot find path 'D:\test.dll' because it does not exist. At C:\Octopus\Work\20160606100457-74\Script.ps1:3 char:10 + copy-item <<<< "D:\test.dll" -Destination "\RemoteIp\c$\Dev"; + CategoryInfo : ObjectNotFound: (D:\test.dll :String) [Copy-Item], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyI temCommand The remote script failed with exit code 1
如果我尝试在 PowerShell 中运行这些代码行,它会正常工作。
有什么建议吗?
谢谢
最佳答案
其实这是我的错。当您在 Octopus 中运行旨在在部署目标上运行的脚本时:
您必须使用 IP 地址定义您的本地电脑。例如,在我的例子中,我必须像这样编写地址“D:\test.dll”:“\192.168.00.00\D$\test.dll”。
对于 regsvr32
问题,我在运行 regsvr32 指令的服务器上添加了一个 bat 文件,我只需调用该文件,它就会完成其余的工作。
希望对其他人有帮助:)
关于PowerShell Copy-Item 在 Octopus 中给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37654852/