WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: rickmds on March 21, 2017, 03:33:51 PM

Title: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: rickmds on March 21, 2017, 03:33:51 PM
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
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: td 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.   

Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: rickmds 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.
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: rickmds 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
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: td 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.
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: rickmds 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.
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: td 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.
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: ChuckC 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.
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: td 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.
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: td 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.
Title: Re: Run As A Service | Windows Server 2008 -> Windows Server 2012
Post by: td 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 (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)