I have a script that copies a setup file to the desktop and runs the install process. The script is truggered from Jenkins.
The problem is that, sometimes, the script fails with Access denied error:
[Error ][Module]: Access to the path 'C:\Users\builder\Desktop\setup.exe' is denied.
I have full administrator rights on the computer and as I mentioned, it does not happen all the times.
my code:
string fullCopyPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + +"\\setup.exe";;
System.IO.File.Copy(fullPath, fullCopyPath, true);
System.Diagnostics.Process installerProcess;
installerProcess = new System.Diagnostics.Process();
installerProcess.StartInfo.FileName = fullCopyPath;
installerProcess.StartInfo.Arguments = "/s /v/qn";
installerProcess.StartInfo.UseShellExecute = false;
installerProcess.Start();
Any idea how can I solve this issue?
start install process fails with Access denied
Re: start install process fails with Access denied
Hi,
Is there a reason why do you copy the setup.exe to desktop? Simply copy it to c:\temp or something similar and I guess the problem will go away?
Anyway, are you sure the test is ALWAYS started as administrator? You see, having administrator rights to the computer may be not enough if you do not run the test as administrator. And it would explain random nature of the problem.
Is there a reason why do you copy the setup.exe to desktop? Simply copy it to c:\temp or something similar and I guess the problem will go away?
Anyway, are you sure the test is ALWAYS started as administrator? You see, having administrator rights to the computer may be not enough if you do not run the test as administrator. And it would explain random nature of the problem.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: start install process fails with Access denied
Actually, there is no special reason for copying the setup file to the desktop. I can copy it to any folder.
Anyway, I'm running the test via Jenkins, to a computer with a administrator rights. Is there a way to run the script with administrator privileges (command line)?
Anyway, I'm running the test via Jenkins, to a computer with a administrator rights. Is there a way to run the script with administrator privileges (command line)?
Re: start install process fails with Access denied
Well, in this case, I would stick with standard user rights and a user/system-less folder. The thing is, that the app started as administrator, always shows the UAC prompt, which must be confirmed manually. I guess there is no easy/standard way to eliminate the UAC dialog? There may be a registry hack or 3rd party tool for this, but I'm not sure it's worth the problems?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: start install process fails with Access denied
I've changed the file copy to temp folder. Still getting Access Denied error.
Re: start install process fails with Access denied
At which line exactly it fails?
BTW, I guess this line is just badly copied/pasted (notice the redundant + and ;)...
string fullCopyPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + +"\\setup.exe";;
BTW, I guess this line is just badly copied/pasted (notice the redundant + and ;)...
string fullCopyPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + +"\\setup.exe";;
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: start install process fails with Access denied
Ignore the redundend +. In the script there is only one.
Anyway, it seems that the copy file succeeds. File exists. I get the error when using install process.
Anyway, it seems that the copy file succeeds. File exists. I get the error when using install process.
Re: start install process fails with Access denied
I see. In this case, check these posts...
https://stackoverflow.com/questions/350 ... pen-folder
https://social.msdn.microsoft.com/Forum ... ess-denied
BTW, is there a reason why you start it via process? Just use Ranorex run app program instead
https://stackoverflow.com/questions/350 ... pen-folder
https://social.msdn.microsoft.com/Forum ... ess-denied
BTW, is there a reason why you start it via process? Just use Ranorex run app program instead
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration