I have some jenkins powershell IIS scripts. I need to run them as admin in jenkins pipeline to make it work. When I try it from jenkins it gives me "Error: Cannot read configuration file due to insufficient permissions". But when I run it from my local ps as admin, it works perfectly. How can I resolve this issue? Thanks!
Related
Created Jenkins job to run silent installation of my application, the application installer is exe file.
tried with Windows Exe Runner - setup.exe /s
tried with PowerShell job - - setup.exe /s
In both cases I get the same issue:
System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
If I run the command manually on the machine from PS run as administrator it will silently install my application in the background without errors.
Suppose it is problem with Jenkins privileges on the server machine, Jenkins is run as a service using Admin credentials.
I'm using GitHub Enterprise with a self-hosted runner that runs on my dev server to accept the build and deploy commands to that server. The build steps are running successfully, but I'm struggling with the deploy steps. The application that is being deployed is an IIS application and I'm trying to run a powershell script I've written to perform the IIS update (stops the IIS server, copies build package contents over to inetpub, starts the IIS server). When the runner executes this script, it fails because it doesn't have permissions to replace the inetpub contents, among other permissions issues. Until now with GitHub Enterprise, I would just run this step as administrator, but I can't find a way to elevate the runner's privileges to do so. Is there syntax for this? This is what I'm currently trying:
- name: Deploy
shell: cmd
run: |
cd myBuildLocation
powershell -file deployrelease.ps1 -inetpubPath C:\inetpub\mySiteName
An Azure VM provisioned and proxy settings are configured. When we do the remote login into the VM machine and insert powershell command as follows:
Find-Module dockeraccesshelper
We get the reponse:
Version Name Repository Description
------- ---- ---------- -----------
0.0.3 dockeraccesshelper PSGallery Allow a user account to access the docker engine...
So it is obvious that from Administrative Powershell command line in the VM machine , I can query for a module in the powershell repository. To confirm it further I issued the following command:
Get-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
And I could see the proxy server listed. I could also see the proxy server listed under Environment Variable listings.
But If I try to execute a powershell script file on the VM from the Azure Devops Pipeline I get the following error:
WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
WARNING: Unable to download the list of available providers. Check your internet connection.
##[error]PackageManagement\Get-Package : No match was found for the specified search criteria and module names 'VSSetup'.
It is understood that VM admin has more access rights than the Azure DevOps Build Agent. But it should at least be able to access the internet.
Let me elaborate more about what the powershell script is doing :
Install some powershell Modules from the ps gallery.
If I run the following as inline command, I get the following response from the pipeline:
Log on to the computer with an account that has Administrator rights, and then try again, or install
'C:\windows\ServiceProfiles\NetworkService\Documents\WindowsPowerShell\Modules'
by adding "-Scope CurrentUser" to your command.
You can also try running the Windows PowerShell session with elevated rights (Run as Administrator).
So it is also abvious that the build agent has to have an elevated access rights as admin to install/update modules. Any hint on how to do it ?
I am facing a very strange issue trying to run a Remote PowerShell script from the new build system of Visual Studio Online.
Context:
I have a Build server that I host on my own VM. I have also created a second VM where I want the PowerShell script to be run on.
When I run a build from the Build server, I want to create a task that run a PowerShell script on a remote machine. Sounds easy.
Both machines have everything configured to run the Remote PowerShell. (I think)
Problem:
If I manually run the script from the build server, the script is properly executed on my remote machine.
But, if I run the script by starting a new build, it doesn't work, I always get an error message
New-PSSession : [xxx.cloudapp.net] Connecting to remote server xxx.cloudapp.net failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
Have you faced this issue before with VSOnline?
This can happen if there isn't a trust relationship between the remote machine and the build machine. E.g. you could look at the hosts.equiv file on the remote machine and make sure it trusts the build machine.
If that doesn't help then more info might be needed, like how you're trying to sign in, what build agent account you're running as.
Guy
I'm unable to execute MSTest on a remote machine from within a powershell remote session, but it works perfectly if I'm logged into that remote machine and run it locally. My guess is that this indicates a permissions issue of some sort, but I have been unable to determine the problem. Here's the 2-liner I use to execute the tests successfully (locally) on the target machine:
PS> $params = #("/testcontainer:MyTests.dll", "/nologo", "/detail:stdout")
PS> & "MSTest" $params
I'm getting the following error when I attempt this through a PSRemote session:
Run has the following issue(s):
Test host process exited unexpectedly.
Failed to queue test run 'username#machinename 2015-08-10 03:30:18': Unable to start the agent process.
Any ideas what might be going on here? I'm using the same credentials to create the PSSession as I use when logging into the target machine with Remote Desktop, but apparently that's no good. Is it possible that because the tests use Selenium ChromeDriver there's some issue with starting a GUI program remotely?