I keep seeing this error sporadically during solution deployment and/or feature activation...
Copying of this file failed . This operation uses the SharePoint Administration service (spadmin), which could not be contacted. If the service is stopped or disabled, start it and try the operation again.
The following is the PowerShell script used to deploy:
$programfiles_path = $null
$stsadm_path = $null
$url = $null
$solution = $null
$feature = $null
$appPoolName = $null
$url = "http://" + ${env:COMPUTERNAME}
$programfiles_path = ${env:ProgramW6432}
if ($programfiles_path -eq $null)
{
    $programfiles_path = ${env:ProgramFiles}
}
$stsadm_path = $programfiles_path + "\common files\microsoft shared\web server extensions\12\bin\stsadm.exe"
if(!(test-path $stsadm_path))
{
    echo "stsadm.exe was not found: $stsadm_path"
    exit -1
}
ECHO "***********************************"
ECHO "*** Contoso.Common.SolutionPackage ***"
ECHO "***********************************"
$solution = "Contoso.Common.SolutionPackage.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.Common.Infrastructure"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.CustomCAS"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.Common.WebParts"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.ExcelExtender"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*********************************"
ECHO "*** Contoso.Something ***"
ECHO "*********************************"
$solution = "Contoso.Something.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.Something"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*********************************"
ECHO "*** Contoso.Nothing ***"
ECHO "*********************************"
$solution = "Contoso.Nothing.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = $null
ECHO "*****************************************"
ECHO "*** Contoso.Everything ***"
ECHO "*****************************************"
$solution = "Contoso.Everything.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.Everything"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*****************************"
ECHO "*** Contoso.CashMoneyMillionaires ***"
ECHO "*****************************"
$solution = "Contoso.CashMoneyMillionaires.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.CashMoneyMillionaires"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "************************************"
ECHO "*** Contoso.DollaDollaBill ***"
ECHO "************************************"
$solution = "Contoso.DollaDollaBill.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
$feature = "Contoso.DollaDollaBill"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force 
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs     
if ($? -eq $false) { exit }
ECHO "************************"
ECHO "*** IIS APPPOOL MGMT ***"
ECHO "************************"
ECHO "*** query wmi for apppool ***"
$appPoolName = "SharedServices1"
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | Where-Object {$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"}
if ($? -eq $false) { exit }
ECHO "*** recycle apppool ***"
$appPool.Recycle()
if ($? -eq $false) { exit }
I have an equivalent batch file which also randomly fails. It fails on different servers. I am quite baffled as to the cause and solution.
Any help would be appreciated.