Run As A Service | Windows Server 2008 -> Windows Server 2012

Started by rickmds, March 21, 2017, 03:33:51 PM

Previous topic - Next topic

rickmds

I have an attached snippet of code works without error as an executable on Windows Server 2008 & 2012.  When it is run as a service on 2008 it works  flawlessly, however when I run it as a service on 2012 it hangs when opening an Excel file.  I determined this by inserting IntControl 38 in quit mode and looking at the generated log file below:

03/21/17  18:16:30  WBT - MCServFTPPutPopSch.exs

1261:  COM/CLR: Exception

oAPP.Open(ScheduleDataFile)

<HR>

Can you please advise on trouble shooting or possible workaround?

Thanks
Rick

td

We don't provide script debugging services but if you can't open a file, it is for one of only a few reasons.  It could be that the file doesn't exist, the file is corrupt, the path is incorrect, or the script does not have the correct permissions to access the file.  It shouldn't be to hard to figure out which one it is based on the context the service is running under.   You are accessing the "D" drive which on servers is generally the "Data" partition on a local physical drive.  If it happens to be a mapped drive instead, it could be the cause of your problem because mapped drives are by default mapped by security id.   

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

rickmds

Thank you Tony for this feedback.  This issue is almost certainly related to permissions and Windows Server 2012 security changes.  It  is a dedicated physical server and Drive D is not mapped.

rickmds

Here is the solution; these directories need to exist.

c:\windows\syswow64\config\systemprofile\desktop
c:\windows\system32\config\systemprofile\desktop

td

Interesting.  There are several reports that  Windows Update can cause these folders to get "wacked".  As far as I can tell MSFT has not owned up to it but does recommend copying the default user desktop contents into c:\windows\syswow64\config\systemprofile\desktop, c:\windows\system32\config\systemprofile\desktop when they are missing. 

Nice bit of debugging and thanx for reporting back.  It could be of help to others with a similar problem.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

rickmds

This was a brand new Windows Server 2012 R2 install on a new dedicated box where it occurred.  We were moving an existing application that uses several ETL Winbatch programs over from a 2008 Server to a 2012.

td

Usually resent versions Windows will update during the OS install process.     However, all of our 2012/2012R2 servers are fully updated and have the afore-mentioned directories.  I happen to be setting up a new 2012r2 server today and it has the directories present, as well.   Of course, it could also have something to do with the OS components that were selected during the install.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

ChuckC

Hmm... Makes me wonder if the base type of the Windows installation is a factor, such as "Core" vs. having the full GUI present.

td

I suspect that  you could not get Excel to run on a core system because many UI system DLLs that Excel uses are missing.  But Windows 2012/ 2012R2 does offer fairly fine grained installation and removal of OS components when the UI is installed.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Happened to be on  a 2012 R2 core server today and it did not have  the "desktop"  sub-directory under systemprofile.  However, it did have the "AppData" directory and the ntuser.dat registry hive.   All of which is more or less what would be expected.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade