How to get Google Chrome version Azure DevOps Command Prompt - selenium

How can I use command prompt to get the Chrome version on the vmImage on Azure DevOps pipeline?

Try below script in Command line task:
wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value
Then choose corresponding vmimage you want to run.

You can get the Chrome version in Azure Devops with a Powershell task containing this code:
$chromeVersion = ((Get-Item "C:\Program Files\Google\Chrome\Application\chrome.exe").VersionInfo).ProductVersion

Related

Display screenshots on test failure in azure devops pipeline

I would like to display a screenshot when a testcafe test is failed in azure pipeline, I can't use anything from marketplace, so it needs to be with copy files task (as recommended by my colleague).
How should I do that?
We cannot show the screenshot in the pipeline, as a workaround, we could show the report.xml content in the pipeline via Logging Commands.
Since the logging command need use local file, we need configure self-hosted agent and copy the report.xml file to another path, then show the report.xml content in the pipeline.
Add the task power shell after the task copy file and enter the below script
Copy-Item -Path $(build.artifactstagingdirectory)\report.html -Destination {local folder path} –Recurse
Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=testcafeFailLog;]{local folder path}\report.html"
Result:
I did a simple test, you could check it

Access denied error using vsts

I'm trying to create a wcf service in a lab using vsts.
I have created a build definition that works using a msbuild task. It then uses robocopy to copy the relevant dlls to a remote directory inside a lab using the Publish Artifacts step.
However, I need the content to be created as a windows service, and started after it has been published. It seems like something is running since I see a created log file about 9 minutes after a successful publish, but i cannot see my service inside the services menu, or in IIS.
When I try to run a bat script (using the run script step) that does an sc create, I get an access denied error even though on the vsts build definition I have given the step permission to modify the environment.
This is the full error:
2018-05-17T13:00:13.7702615Z ##[section]Starting: Run script GloBill/InstallBackEnd.bat
2018-05-17T13:00:13.7705444Z ==============================================================================
2018-05-17T13:00:13.7705561Z Task : Batch Script
2018-05-17T13:00:13.7705655Z Description : Run a windows cmd or bat script and optionally allow it to change the environment
2018-05-17T13:00:13.7705748Z Version : 1.1.3
2018-05-17T13:00:13.7705824Z Author : Microsoft Corporation
2018-05-17T13:00:13.7705924Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613733)
2018-05-17T13:00:13.7706023Z ==============================================================================
2018-05-17T13:00:13.7775377Z ##[command]C:\agent\_work\1\s\GloBill\InstallBackEnd.bat
2018-05-17T13:00:13.8030595Z
2018-05-17T13:00:13.8031049Z C:\agent\_work\1\s>sc create GloBillBackEnd ../Services/GloBill.WS.exe
2018-05-17T13:00:13.8048684Z [SC] OpenSCManager FAILED 5:
2018-05-17T13:00:13.8048781Z
2018-05-17T13:00:13.8048901Z Access is denied.
2018-05-17T13:00:13.8048957Z
2018-05-17T13:00:13.8064609Z ##[error]Process completed with exit code 5.
2018-05-17T13:00:13.8073202Z ##[section]Finishing: Run script GloBill/InstallBackEnd.bat
I'm running out of ideas.
The problem was that I was trying to deploy a release from a hosted agent that resided on another machine.
I had to configure a new agent solely for deploying, then i had to tweak my installation script a little by adding the -executionpolicy bypass command.
Here is the new script:
(%1 is the file path)
Powershell.exe -executionpolicy bypass -File %1 -username Username -password ****** -exepath *exe* -serviceName *svcName*

Azure powershell not executing, version issue

I created a VSTS Release Definition with that contains a Azure Powershell script
When I create a release from the following definition everything works until I get to the Azure Powershell script, I get the following log:
2016-08-02T19:06:33.1625377Z ##[command]Import-Module -Name C:\Program
Files (x86)\Microsoft
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1
-Global 2016-08-02T19:06:37.8986980Z ##[command]Add-AzureRMAccount -ServicePrincipal -Tenant ******** -Credential System.Management.Automation.PSCredential 2016-08-02T19:06:39.0397286Z
[command]Select-AzureRMSubscription -SubscriptionId ******* -TenantId ******** 2016-08-02T19:06:39.1837302Z ##[command]& 'C:\a\e214cea58\ContinuousBuild\drop\Deployment\PrepareIoTSample.ps1'
-environmentName test -configuration debug -webPackageLocation "C:\a\e214cea58\ContinuousBuild\drop\Web\Web.zip"
-webJobPackageLocation "C:\a\e214cea58\ContinuousBuild\drop\WebJob\WebJobHost.zip"
2016-08-02T19:06:40.3037302Z ##[error]Cannot find path
'C:\a\e214cea58\ContinuousBuild\VERSION.txt' because it does not
exist. 2016-08-02T19:06:43.3880731Z ##[error]Version 1.3.2; update to
1.4.0 and run again.
I tried to google the errors but didn't find anything usefull, and I don't see an option to enter a version number. Can someone point me in the right direction?
You can't run a lower version of AzurePS because there can be only one version of Azure PS installed at a time on a single machine.
The online build machines being maintained by Microsoft they all have the same version of Azure PS. (I'm assuming you're using the hosted agent)
I'd suggest you upgrade your script so it runs properly with the new version of Azure PS

run Pentaho transformation from Pan fails

I get an "not recognised as an internal or external command " error message when I run the following command:
C:\pdi-ce>Pan.bat /file=c:\pdi_labs\matches.ktr usa_201210.txt
pentaho 4.4.0 community edition is installed in :
C:\pdi-ce
transformation and files are saved in :
C:\pdi_labs\
Any hint to run the transformation from Pan since I am able to run it from Spoon.
regards
Generally Pentaho kettle creates another wrapper folder "data-integration" in installation directory. Check whether Pan.bat exists in the directory. If not cd to the directory which has it.
Pan.bat -file="c:\pdi_labs\matches.ktr" > usa_201210.txt
Assuming usa_201210.txt is the log file.
I would recommend starting pan.bat in a different shell and make it wait until it completes as below.
start /wait cmd "c:\pdi-ce\Pan.bat -file=c:\pdi_labs\matches.ktr > usa_201210.txt"
cd /C:/pdi-ce/
Pan.bat /file:"c:\pdi_labs\matches.ktr" /usa_201210.txt

How to run a CruiseControl task as an administrator in Windows Server 2008

I'm currently using CruiseControl.NET to automate my build. We have two different ways to build a solution in my build environment - one is through the Keil uVision4 IDE, the other is through Visual Studio 2008.
I've successfully gotten the Visual Studio solution to build properly using CruiseControl.NET and have created a batch file which properly uses Keil's uVision command line interface to compile my uvproj Project (compilation details here).
Problem Description
1) I can successfully execute the build script on my Windows 2008 server and build the project if I create a command prompt with administrator privileges (I'm doing this manually - start -> run -> cmd with ctrl-shift-enter to run as admin).
2) However, if I create a command prompt without administrator privileges, and attempt to execute the batch file, the batch file won't work unless I accept the prompt asking me to confirm admin rights are required to run the batch script.
How do I automatically execute a batch file as an administrator through CruiseControl?
Is this something that could be automated using the RunAs command?
Technical details
1) The batch file being executed is pretty simple - it deletes the old output and re-makes the output, creating a build log file in the location below.
set BuildLogLocation=BuildLog\BuildLog.txt
echo on
cd ../..
cd PTM
rmdir /s /q output
mkdir output
mkdir BuildLog
C:\Keil\UV4\UV4.exe -r myProj.uvproj -o %BuildLogLocation%
echo ErrorLevel of build is %ERRORLEVEL%
echo build complete, see %BuildLogLocation%
2) Currently I'm looking to use the Exec functionality to run the Keil build script above:
<Exec>
<Command>C:\myProject\Build\KeilBuild\BuildScript.bat<Command/>
<buildTimeoutSeconds>600<buildTimeoutSeconds/>
<!-- Details about error codes can be found here:
http://www.keil.com/support/man/docs/uv4/uv4_commandline.htm -->
<successExitCodes>0,1</successExitCodes>
<Exec/>
Related questions:
How can I use a build server with Keil uVision4 (MDK-ARM), script a build, use a makefile? (Electrical Engineering)
Execute a command-line command from CruiseControl.NET (Stack Overflow)
Can you run CCService, the CruiseControl.NET Windows Service, as a user who has administrative permissions? I'd try that first.
If that doesn't work, I would use runas to run your script. You'll have to embed the administrative user's password in the script calling runas.
I know this is old but, Did you get an offical way to do it Via Cruise Control?
Normally I create this and call it to call other processes "As Admin".
Make a ".VBS" script with This in the contents:
Dim strBatchPath
strBatchPath = "PATH-TO-FILE.EXE"
Set runBatch = CreateObject("shell.application")
runBatch.shellexecute strBatchPath,,,"runas",1
That could be an option to people that can't find an official way
You could try psExec from sysinternals. If you don't need to run as a nt-authority account you should be able to use this in the same way as runas.
It allows you to pass in the username/password as a switch (if memory serves)
I have Discovered that when using PSEXEC and using the -h switch, it then "runs as admin" on destination
e.g.
psexec -h \ServerToRunOn /accepteula -u DOMAIN\USER -p PASSWORD "PATH-TO-FILE"
I am Using CC.Net to call a batch file with the above in. This will run that file as Admin