viewpoint-particle

Author Topic: Run As A Service | Windows Server 2008 -> Windows Server 2012  (Read 1006 times)

rickmds

  • Newbie
  • *
  • Posts: 39
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

  • Tech Support
  • *****
  • Posts: 2223
    • WinBatch
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #1 on: March 21, 2017, 05:19:49 pm »
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.   

"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


rickmds

  • Newbie
  • *
  • Posts: 39
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #2 on: March 22, 2017, 03:39:33 am »
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

  • Newbie
  • *
  • Posts: 39
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #3 on: March 23, 2017, 03:51:13 pm »
Here is the solution; these directories need to exist.

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

td

  • Tech Support
  • *****
  • Posts: 2223
    • WinBatch
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #4 on: March 24, 2017, 07:07:14 am »
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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


rickmds

  • Newbie
  • *
  • Posts: 39
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #5 on: March 24, 2017, 02:39:49 pm »
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

  • Tech Support
  • *****
  • Posts: 2223
    • WinBatch
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #6 on: March 24, 2017, 03:07:08 pm »
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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


ChuckC

  • Full Member
  • ***
  • Posts: 117
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #7 on: March 27, 2017, 09:45:52 am »
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

  • Tech Support
  • *****
  • Posts: 2223
    • WinBatch
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #8 on: March 27, 2017, 01:00:20 pm »
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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


td

  • Tech Support
  • *****
  • Posts: 2223
    • WinBatch
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #9 on: March 30, 2017, 08:51:09 am »
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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


td

  • Tech Support
  • *****
  • Posts: 2223
    • WinBatch
Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
« Reply #10 on: April 10, 2017, 10:16:11 am »
Looks like I need to follow my own advice.   The Tech Database article linked below covers the subject of this topic:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~Excel+Excel~2007~and~Windows~Server~2008~x64~Problem.txt
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates