I have a script that executes an aws s3 sync, which should sync approx 255GB. However, the script seems to choke up at random points and exit with:
[13:49:24][Step 1/1] Processing data for a remote command failed with the following error message:
[13:49:24][Step 1/1] Access is denied. For more information, see the about_Remote_Troubleshooting
[13:49:24][Step 1/1] Help topic.
[13:49:24][Step 1/1] + CategoryInfo : OperationStopped: (fileserver:String) [], PSRemotingTransportException
[13:49:24][Step 1/1] + FullyQualifiedErrorId : JobFailure
[13:49:24][Step 1/1] + PSComputerName : fileserver
[13:49:24][Step 1/1]
This error occurs after varying amounts of time, and varying amounts of data pulled down from S3. There doesn't seem to be a common denominator for when its dying. Another important fact is that the script is being executed by TeamCity, so it's logging in from TC as an admin on the remote server.
Any ideas on why this is occurring?
Related
I am trying to copy files from Windows 10 host to Ubuntu VM (Hyper-V) using this command:
Copy-VMFile "UbuntuVM" -SourcePath C:\Users\file.pcap -DestinationPath "~/opt/..../file.pcap" -CreateFullPath -FileSource Host
The destination path is my Ubuntu location, however it does not feel right to map it this way.
When executing the command in powershell it give the following:
Copy-VMFile : Failed to initiate copying files to the guest. Failed to copy the source file to
the destination
+ CategoryInfo : NotSpecified: (:) [Copy-VMFile], VirtualizationException
+ FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.CopyVMFile
The guest options are enabled.
Could somebody help me with this issue?
When I use adb pull command to copy file from a device to pc in PowerShell, I get this:
PS>.\adb.exe pull '/sdcard/temp/screenshot.png'
.\adb.exe : 6040 KB/s (34027 bytes in 0.005s)
At line:1 char:1
+ .\adb.exe pull '/sdcard/temp/screenshot.png'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (6040 KB/s (34027 bytes in 0.005s):String) [
], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
The file is actually copied though.
The problem is that I want to use it in a loop, so when it throws an exception, script stops playing.
The same command in cmd works perfect.
It is common for exe's to send information down the error stream. I'm sure that is what you are seeing here as well. The "error" (read that like I used finger air quotes) is most likely coming from this line
.\adb.exe : 6040 KB/s (34027 bytes in 0.005s)
If you are familiar with psexec the initial banner of information is on the error stream.
Since that data is on the error stream PowerShell reports it as such. As you have done in comments redirecting the error stream to null is an acceptable was to deal with that. 2>$null
You could also experiment with Start-Process if you don't need the output returned.
Start-Process adb.exe -ArgumentList "pull '/sdcard/temp/screenshot.png'"
You just have to be careful if there actually is an error in either case.
I am setting up the build process for a desktop application on Visual Studio Team Services (i.e. Visual Studio Online) and would like to run the squirrel installer Releasify command automatically under some build cases. So far I have created the following powershell script that I am running after the project gets built
Write-Host "Hello World from $Env:AGENT_NAME."
Write-Host "Current Path $env:Agent_BuildDirectory"
Write-Host "Build Number $env:Build_BuildNumber"
$squirrel = "$env:Agent_BuildDirectory\packages\squirrel.windows.*\tools\Squirrel.exe"
.$squirrel -releasify "$build_dir\MyNupkg.nupkg"
This is leading to the following error message
2015-12-29T12:57:48.5701506Z ##[error]. : The term 'C:\a\1\packages\squirrel.windows.*\tools\Squirrel.exe' is not recognized as the name of a cmdlet,
2015-12-29T12:57:48.5701506Z ##[error]function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
2015-12-29T12:57:48.5701506Z ##[error]path is correct and try again.
2015-12-29T12:57:48.5701506Z ##[error]At C:\a\1\s\MyDir\Release.ps1:5 char:2
2015-12-29T12:57:48.5701506Z ##[error]+ .$squirrel -releasify "$build_dir\MyNupkg.nupkg"
2015-12-29T12:57:48.5701506Z ##[error]+ ~~~~~~~~~
2015-12-29T12:57:48.5701506Z ##[error] + CategoryInfo : ObjectNotFound: (C:\a\1\packages...ls\Squirrel.exe:String) [], CommandNotFoundException
2015-12-29T12:57:48.5701506Z ##[error] + FullyQualifiedErrorId : CommandNotFoundException
2015-12-29T12:57:48.5701506Z ##[error]
2015-12-29T12:57:48.5701506Z ##[error]Process completed with exit code 0 and had 1 error(s) written to the error stream.
How can I fix this error? Is there a better approach? Why can't powershell run a program that is in that directory?
The error is pretty clear:
It's not finding the file in the path you're specifying, which is: C:\a\1\packages\squirrel.windows.*\tools\Squirrel.exe
Correct the path to point to the correct folder.
"$env:Agent_BuildDirectory" is the local path on the agent where all folders for a given build definition are created. It isn't the complete path for your project solution. You need to use the path "$env:BUILD_SOURCESDIRECTORY\\" to navigate to packages folder. So update the script to following should fix your problem:
$squirrel = "$env:BUILD_SOURCESDIRECTORY\<project name>\packages\squirrel.windows.*\tools\Squirrel.exe"
Furthermore, I have the plugin for de powershell instaled.
In the configuration job, I have this:
But, I have the next error when execute the job:
.ps1 cannot be loaded because the
execution of scripts is disabled on this system. Please see "get-help about_si
gning" for more details.
At line:1 char:2
+ & <<<< 'C:\Windows\TEMP\abc.ps1'
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
Build step 'Windows PowerShell' marked build as failure
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
I think that this is because my instance of Jenkins not is administrator.
Note:
- I have a instance of Jenkins in my machine local
- And when I compile from my windows power shell console, this if execute (This is possible with this instruction "Set-ExecutionPolicy Unrestricted")
You need to set the execution policy on the server.
You can set the execution policy by typing this into your powershell window:
Set-ExecutionPolicy RemoteSigned
For more details https://technet.microsoft.com/en-us/library/ee176961.aspx
Don't run Jenkins server using service... Run jenkin server in cmd window(without window service)
We have a powershell build script that calls out to other scripts that is giving me trouble under Windows 7 64 bit. It works fine under XP. I've run set-executionpolicy to RemoteSigned (and also tried it with Bypass and Unrestricted). I can pull the command line from the error message and run it myself and it all runs fine.
Build errors look terrible here; but I'm including them anyway for completeness.
Project "C:\dev7\Source\DashPortal\DashboardGenerator\DashboardGenerator.csproj" (2) is building "C:\dev7\Source\DashPo
rtal\DashboardController\DashboardController.csproj" (15) on node 0 (default targets).
File C:\Users\pmckinney.NA\Documents\WindowsPowerShell\profile.ps1 cannot be lo
aded because the execution of scripts is disabled on this system. Please see "g
et-help about_signing" for more details.
At line:1 char:2
+ . <<<< 'C:\Users\pmckinney.NA\Documents\WindowsPowerShell\profile.ps1'
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
File C:\dev7\Source\DashPortal\DashboardController\..\..\..\Build\createReportI
nstallScript.ps1 cannot be loaded because the execution of scripts is disabled
on this system. Please see "get-help about_signing" for more details.
At line:1 char:87
+ C:\dev7\Source\DashPortal\DashboardController\..\..\..\Build\createReportInst
allScript <<<< -t C:\dev7\Source\DashPortal\DashboardController\..\..\..\Sourc
e\DashPortal\DashboardReports\ReportSetupScriptTemplate.sql -l C:\dev7\Source\D
ashPortal\DashboardController\..\..\..\Source\DashPortal\DashboardReports\Repor
tSetupReportList.xml -c C:\dev7\Source\DashPortal\DashboardController\..\..\..\
Source\DashPortal\Config
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
C:\dev7\Source\DashPortal\DashboardController\DashboardController.csproj(265,5): error MSB3073: The command "powershell
C:\dev7\Source\DashPortal\DashboardController\..\..\..\Build\createReportInstallScript -t C:\dev7\Source\DashPortal\Da
shboardController\..\..\..\Source\DashPortal\DashboardReports\ReportSetupScriptTemplate.sql -l C:\dev7\Source\DashPorta
l\DashboardController\..\..\..\Source\DashPortal\DashboardReports\ReportSetupReportList.xml -c C:\dev7\Source\DashPorta
l\DashboardController\..\..\..\Source\DashPortal\Config" exited with code 1.
Just guessing: You did run Set-ExecutionPolicy in your x64 PowerShell and the build runs the x86 PowerShell?
Maybe try Get-ExcutionPolicy in both shells.
Edit: oops, I see you already enabled scripts. It's possibly something to do with the context under which MSBuild is running. Are you running MSBuild as a local service account of some kind?
Edit2: It's clear the error message is deceptive. There's something else going on and the execution policy error is being thrown but not for the expected reason. Perhaps as a way to isolate, try creating another MSBuild task that runs the same line but with shorter, hardcoded paths instead of the /../../../ bonanza above?