steff Posted May 25, 2011 Posted May 25, 2011 (edited) Hi gurus, It's been some days I'm breaking my head on a problem. I wrote a program which I need to run as a service and write to a shared folder (say z:\share). Installed with instsrv.exe and srvany.exe and changed the "Log on as" to the domain administrator. The program periodically copies some local file to the shared folder: I changed the group policy setting to allow read/write to that folder to the domain admin. If I only run a FileExists over it, it doesnt work. $sharedFolder="z:\share" If FileExists($sharedFolder) Then ...do something... The strange is, if I run it as a normal program and not as a service, it works well, the shared folder is detected and the file are copied. Does anybody have any idea on how to solve it with autoit? Thanks in advance for replies stefano Edited May 25, 2011 by steff
MrMitchell Posted May 25, 2011 Posted May 25, 2011 If it's running as a service one possibility is that the share isn't ready yet when the service runs (i.e. as soon as Windows starts?). Put some kind of wait time before the script actually gets to work, or put something in there to somehow wait for the share to become available...
water Posted May 25, 2011 Posted May 25, 2011 Two things come to mind:The drive Z: is missing. Shares are mapped to drive letters during logon (at least in our environment). Non interactive users don't get shared drives mapped. A solution would be to use UNC notation like "\\servername\sharename" or AutoIt function "DriveMapAdd"Missing permissions. The service might run under a different account and therefore doesn't have the proper permissions My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Juvigy Posted May 25, 2011 Posted May 25, 2011 I am pretty sure the service run as the "system" account. It doesnt have permissions to the share drive. I had the same issue long time ago.
steff Posted May 27, 2011 Author Posted May 27, 2011 I think water is right: also my research say only interactive logon can let a user map remote drives, no matter if the service is run by an account who has actual access to those folders. The easiest way to access remote drives is to use the UNC notation (like "\\servername\sharename" ), and that's what I'm going to do. Thanks to all replies, guys!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now