Unable to open word document from jenkins - windows

I have one windows utility which opens word document, extract data out of it and generate another word document using that data.
Now my problem is that this windows exe is working fine directly on command prompt, but if I call this exe through jenkins, i.e. build step "Execute windows batch command" it gives error, it is not able to open word document so utlity exists with error.
I have tried other options also like calling exe from pom file, and from batch file. every time it gives me same error. My tomcat service is running with the same user from which I am login to windows.
Any guidance on this topic will helpful.

You have to add "Desktop" folder in BOTH locations: C:\Windows\System32\config\systemprofile\Desktop
and
C:\Windows\SysWOW64\config\systemprofile\Desktop

Jenkins is not able to manage such application with a GUI as Tomcat is launched with a Windows service.
One option is to try to check this option on your Windows service: "Allow service to interact with desktop"
If it doesn't solve your problem, I'm not sure you will find a solution :(

Create an empty directory "Desktop" in
C:\Windows\SysWOW64\config\systemprofile\
this solved the issue.
I guess this is problem with user rights for the desktop folder under users directory. The user by which tomcat service is running.

Related

adding a service to windows from vb.net

I've created a windows service application and I'm working on the installer for this service application at the moment, as there's lots of user options that need defining.
Previously when I needed to create a service I've just created a .bat file containing a relevant SC Create command in temp and executed it to add my service, however I wondered if there's a way to add the service directly rather than creating and executing a bat file.
You don't need the temporary .bat file. You can run any command through Process.Start without a temporary file.
Maybe you should think about your installer technology though. A VB.NET executable means people will have to run an installer for that first, then start it to have an installer for the service. I would be slightly amused by having to install the installer.
Wix for example can build installer packages that install a service. Other alternatives are out there too (but this one is free).

Preventing Powershell from adopting Windows Explorer options

I don't do much with Powershell often but yesterday was needing to extract a file from a zip archive. During the process I was looking for a file by iterating through the contents of a zip anbd comparing the file's (item) Name property to the filename (say abc.ps1).
Code was working locally and I was happy with the result I was getting.
Pushe the code to deployment environment to be run on server and the code was notifying me that it could not find abc.ps1.
Further investigation, I logged onto the server (as my own account, not the service account that the code executed as). When I looked in the zip it was querying I could see the file, but it was named abc.
I had xyz.txt and def.pdf but the ps1 file was simply abc. I knew that this is based on an Option in Windows Explorer options for 'Hide extensions for known file types'.
Logging on to the server with the service account, unchecking this option and re-running the script fixed all problems, it was able to fid the file based on name + ext.
Is there a way of enforcing PS not to take into account Explorer options such as these when running?
Am currently thinking of applying a GPO to prevent any systems from having this option on.

user.home in windows ts running eclipse rcp project

So me and a friend have created an application using Eclipse RCP. Now we want to distribute it using Windows Terminal Services. I have Windows TS up and running and have added about 6 accounts on it. I have also deployed my Eclipse RCP applications using the TS Remote App Manager. The application needs to create a folder in the users folder to store data, so the configuration is set up to create this folder "#user.home/...." Great, so now we try to access it from our TS Web Access site.
The first two accounts we have tried to run it on work fine, and are performing the way we desire. However, the remaining start the application but immediately give me an error message saying that we dont have access to the configuration folder at C:/Users/Administrator/... I can see the problem is that my users don't have the authority to write to the Admin folder, but I am confused as to why the user.home is referencing the Admin folder instead of the users folder. I have tried changing the users home folder in the profile and Terminal Services section of their properties but neither of these makes a difference. Does anyone know why user.home would return the Admin folder. Thanks!
Turns out the "Home" key was not set up in the users directory. It could be fixed by following the directions in the answer found here. Java user.home is being set to %userprofile% and not being resolved

What is the path to an installed ClickOnce application?

I wrote a "Hallo world" type Windows Forms application in C# to test authentication issues. I'm going to be running the eventual application from a server periodically, so I want to be sure I can get to the resources, and fix that before committing to the whole application.
So, in Visual Studio 2010, I choose Publish....
It says "Where?", and I specify a folder on a shared file system.
It says "How will your users install", and I say, "URL" or something like that.
It says "Where", and I give it a URL in the same shared file system, different folder.
All is right with the world....
Now, I install it on my server by double-clicking "setup" on the shared file system where I published the application.
Now, I find a shortcut in my start menu, all good.
Now, I want to set it up so SQL Server Agent executes it periodically (and tests authentication...) so, what is the URL I give it to execute? I've been trying everything, but not going so well. I don't understand the publish method much at all....
How can I fix this problem?
Look at the Start menu shortcut for your installed application and you'll see that it points to a "ClickOnce Application Reference" (.appref-ms) file buried deep within your user folder. You can start the application by executing that file.
Example:
Process.Start(#"C:\Users\Igby\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Microsoft\MyClickOnceApp.appref-ms");
I don't know anything about SQL Server Agent, but try giving it this path.

Cannot start a Windows service not located in the 'Program Files' folder on Windows 7

I have recently switched to Windows 7 as my development machine. One of the components of the software that I work on is a Windows service. One of the tricks I use to debug the service is to make the service registry values point to my debug build of the service. I then start the service and attach to the process using VS.NET.
However, when I try to do this on Windows 7 and try to start the 'debug' version of the service I get an error message telling me that 'access is denied'. I thought there must be something wrong with my debug build of the service. But to troubleshoot the problem I tried creating a folder under 'Program Files' named 'DebugService', copying the contents of the debug build folder to this folder and pointing the service at this location. I was then able to start the service without error.
Has anybody come across this restriction in Windows 7? Having to copy the build output to a folder in 'Program Files' is inconvenient and my service is also experiencing permissions problems opening certain files that are located in this 'Program Files' folder (the installed version of the service has no such problems).
Is there some something I can do to Windows 7 to tell it that it's okay to start a service located in a folder that is not under 'Program Files'?
Heh, I don't think there's anything special about Program Files... But there very likely is something special about your build location: it belongs to you, and not to the Users group. Assuming you're not running the service as yourself (or SYSTEM), that puts it in the uncomfortable position of trying to run a program that can't access its own code!
I just set up a separate directory tree off of root, accessible by the Users group, and build my stuff there. But you could certainly assign the necessary permissions to whatever directory you're already using.

Resources