After downloading the vNext build agent from VSTS page or from on-premises TFS, I followed the steps to configure agent in Powershell ISE.
Upon running .\config.cmd, there is a display of >> Connect:
There is no other prompt further to proceed with the configuration like below.
Tried the same with Powershell console and it worked.
Why is it so? Why is it not working with ISE?
The PowerShell ISE does not support console applications that require interactive input. You can check this blog.
So you need to use PowerShell Console or Command Prompt to config build agent.
Related
Having an unusual issue where as part of a step in my Azure Pipeline, i am installing an application (.exe) via cmd/script.
The self hosted agent is running on my PC. When the pipeline triggers the exe install step (quite/headless mode) , the installer hangs.
If I run the same command from my command prompt, it installs fine.
Tested with notepad++ to see if it was an issue with my own application and same probelem exists.
Do i need to specify any additional privileges when installing an exe from Azure pipeline
I created a classic CI pipeline in azure devops to run aws commands using "AWS CLI template". I used "aws configure sso" command in AWS CLI but when I run the pipeline, I'm getting this error- No windows console found. Are you running cmd.exe? And the process failed with exit code 255" what is this error exactly and please anyone tell me, how can I remove it?
What is the OS of the agent you used to run the CI pipeline? Windows, Linux or macOS?
According to the introduction about the extension "AWS Toolkit for Azure DevOps", the AWS CLI task is only available on Windows agent.
Looks like this task can only call the cmd.exe to execute the command. And the cmd.exe is only available on Windows.
[UPDATE]
What agent did you use? Microsoft-hosted Windows agent, or self-hosted Windows agent?
Please make sure the cmd.exe has been installed on the Windows machine, and has been added to the system environment variable.
You can run the bash command printenv to list all the system environment variables, then check if this COMSPEC=C:\Windows\system32\cmd.exe is listed.
If the cmd.exe also has been installed correctly on your local Windows machine, you can try directly executing the related AWS CLI command on you local Windows machine to see if the same issue occurs. If the same issue occurs, the problem should occur on the AWSCLI itself.
If the issue only occurs when using the AWS CLI task, the issue should occur on the task itself, you can report this issue on the Q & A tab of the extension on Marketplace.
We have configured a windows virtual machine and deployed an agent there to build our code and run scripts.
In our VM we two different flavors of PowerShell command prompt:
Windows PowerShell
Developer PowerShell for VS 2019.
How can we start "Developer PowerShell for VS 2019" from our pipeline YAML script and execute our checked out .ps1 file there?
There are several flavors of PowerShell tasks that can be initiated from the pipeline though and not sure which one of them will serve the purpose. They are the following:
Azure PowerShell
PowerShell
PowerShell on Target Machine
Service Fabric PowerShell.
Which of the above represent "Developer PowerShell for VS 2019"?
The reason behind this specific flavor of PowerShell is:
Need to have some of the .NET Framework Tools (CorFlags.exe) which are only accessible in the "Developer PowerShell for VS 2019" and not in the other one.
The Developer PowerShell for VS 2019 is a regular PowerShell with a module imported, you can see exactly what in this way:
Go the Start menu and search for Developer PowerShell for VS 2019.
Right-click on it and Open file location - you will get this:
Now right-click again on the Developer PowerShell for VS 2019 shortcut and Properties.
You will see in the location that is run the regular PowerShell with some command:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -noe -c "&{Import-Module """C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell bc97b47b}"
Now, if you open a PowerShell and run the script there:
&{Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell bc97b47b}
You will get the Developer PowerShell for VS 2019 and CoreFlags.exe will work:
So, you need to use the regular PowerShell task (your option 2) and run the above command at the begging of the script.
Note: you should copy exactly the command you see in the Properties, in each machine it could be different.
I have installed the required software and Azure PowerShell cmdlets on local system. I tried to execute a powershell script by connecting to Azure from Visual Studio Code Terminal. Below is the error.
Import-Module Microsoft.Online.SharePoint.PowerShell
function PublishToAzure{
Add-AzureAccount
......
......
}
Error is..
Add-AzureAccount : The handle is invalid
Visual Studio Code Settings:
// Place your settings in this file to overwrite the default settings
{
"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
}
Console of Windows Azure Active Directory Module for Windows PowerShell Properties
Target is:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command "Import-Module MSOnline"
System Properties: 64bit Win7 OS
You may connect and manage Azure resources from within VS Code's terminal window by installing Microsoft Azure CLI 2.0. (https://aka.ms/InstallAzureCliWindows).
After CLI 2.0 is successfully installed in your environment, add the CLI 2.0 components to your environment path.
For example, my environment is Windows 10 and VS Code v1.13.0. I successfully ran the CLI 2.0 MSI installer for Windows. In my VS Code terminal session, I add the path to my PowerShell environment via this command:
$Env:Path += ';C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin'
To work within my Azure subscription(s), first I login via the command
az login
Follow the prompts to browse to a URL to complete the login to your Azure account and authorize the CLI session. Additional help on CLI 2.0 commands may be found at this link, https://aka.ms/cli
I know this thread is old and my answer a bit late but I hope this helps someone.
Cheers,
CarnegieJ
I have to install a program on a Windows 8 server using Jenkins as a framework. I wrote a PowerShell script that does run and install executable files when run through the PowerShell console. This does not happen when I run the same scripts through Jenkins.
Nothing happens except the text I output does appear on Jenkins' console.
Can running an .exe be done on Jenkins through a PowerShell script? Please help! Thanks :)
Read a similar answer here:
Open Excel on Jenkins CI
The issue is that Jenkins on Windows usually runs in "Session 0". Which is not visible to the logged in user. The trick is to launch the process (Excel in that answer, PowerShell in your case) in session 1.