我有一個Jenkins的工作,它在低於活動。Copy-Item:進程無法訪問文件
- 停止WebService的
- 刪除的WebService
- 從詹金斯的工作空間複製內容到服務器的路徑
- 創建的WebService
- 開始的WebService
下面是我的PowerShell腳本:
Get-ChildItem "C:\Location\*"
$service = Get-Service -Name value -Computername $env:SERVER -ErrorAction SilentlyContinue
sc.exe \\$env:SERVER stop value
Write-Host "value STOPPED"
sc.exe \\$env:SERVER delete val
Write-Host "val DELETED"
Copy-Item "C:\Location\*" "\\$env:SERVER\d$\Location" -Force -Recurse
sc.exe \\$env:SERVER create val start=auto DisplayName ="val" binPath= D:\Location.exe
sc.exe \\$env:SERVER description value"value"
sc.exe \\$env:SERVER start value
Write-Host "value STARTED"
if ($error) { exit 1 }
個
錯誤日誌:
Copy-Item : The process cannot access the file '\\Location' because it is being used by another process. At C:\Users\Administrator\AppData\Local\Temp\hudson2059984936352103941.ps1:18 char:5 + Copy-Item "C:\Location\*" " ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Copy-Item], IOException + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand [SC] CreateService FAILED 1072: The specified service has been marked for deletion. [SC] ChangeServiceConfig2 FAILED 1072: The specified service has been marked for deletion. [SC] StartService FAILED 1058: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
能否請你幫我出這個錯誤?我是否需要重新啓動部署服務器,以便我的進程被終止?如果是這樣,我覺得這是不相關的,不能在prod服務器上做。
只是找到阻止該DLL並阻止它的過程 – 4c74356b41
@ 4c74356b41我無法找到任何具有該名稱的進程。 – Kally