Daedroth Posted March 18, 2014 Share Posted March 18, 2014 Hello, basically I have a situation where a VBScript performs a few against queries a mapped drive. It works perfectly as an interactive sessions (such as my user account). However, I do not want it to require an interactive logon, I want it to run as a service account, or something similar, so that it does not require my user input. Here is the layout: 1x FreeNAS server with a network share named 'Share1' 1x Windows Server 2008 R2 with a mapped Z:\ drive connecting to \\FreeNAS\Share1. I log onto this Windows Server and run a vbscript that performs queries against the Z:\ mapped drive. Can this be performed without an interactive logon? Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/ Share on other sites More sharing options...
+BudMan MVC Posted March 19, 2014 MVC Share Posted March 19, 2014 Where you can run into an issue is if this location your running the script from has other sessions open to this freenas, lets say billy is logged into the box where the script runs and has a connection to this freenas\share1 -- you can not create another session to freenas from the same location with different credentials. Its quite possible to create the session using whatever creds you want in your script to access the resource -- but if that source has other sessions open to that server your most likely going to have issues. You normally can not have multiple sessions to the same server from the same location with different creds. Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/#findComment-596318989 Share on other sites More sharing options...
Daedroth Posted March 21, 2014 Author Share Posted March 21, 2014 On 19/03/2014 at 15:18, BudMan said: Where you can run into an issue is if this location your running the script from has other sessions open to this freenas, lets say billy is logged into the box where the script runs and has a connection to this freenas\share1 -- you can not create another session to freenas from the same location with different credentials. Its quite possible to create the session using whatever creds you want in your script to access the resource -- but if that source has other sessions open to that server your most likely going to have issues. You normally can not have multiple sessions to the same server from the same location with different creds. Thanks for your reply. The script would only be ran once a day to query the free space remaining on the drive, so there isn't an issue with different credentials. However, I do not wish a user to be logged in at all, just having it run as a service account. However I do not think that service accounts can map z:\freenas\share1, as it isn't interactive. Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/#findComment-596322169 Share on other sites More sharing options...
sc302 Veteran Posted March 21, 2014 Veteran Share Posted March 21, 2014 run it as a scheduled task, you won't neet to be logged in with anyone, it will just run. You can schedule it to run once a month, once a week, once a day, once every minute...alternate months, weeks, days, hours, minutes, etc. I would think that would be better for you than run as a service. Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/#findComment-596322505 Share on other sites More sharing options...
Daedroth Posted March 23, 2014 Author Share Posted March 23, 2014 On 21/03/2014 at 13:10, sc302 said: run it as a scheduled task, you won't neet to be logged in with anyone, it will just run. You can schedule it to run once a month, once a week, once a day, once every minute...alternate months, weeks, days, hours, minutes, etc. I would think that would be better for you than run as a service. But can I map a Z:\ drive as a scheduled task without anybody logged on? Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/#findComment-596325587 Share on other sites More sharing options...
sc302 Veteran Posted March 23, 2014 Veteran Share Posted March 23, 2014 Why would you not simply do what you need to do with the unc path vs mapped drives. Drive mapping is for user ease..vbscript should not care between user drive mapping and actual path. Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/#findComment-596325743 Share on other sites More sharing options...
Daedroth Posted March 25, 2014 Author Share Posted March 25, 2014 On 23/03/2014 at 12:39, sc302 said: Why would you not simply do what you need to do with the unc path vs mapped drives. Drive mapping is for user ease..vbscript should not care between user drive mapping and actual path. Unforutunately I don't know how to do that. All my attempts of using the UNC share have shown the CIFS share as having 0 bytes free. (The same as browsing to the UNC path and selecting properties). However, when it is mapped, Windows knows how large and how much is used of the drive as it acts as a volume, rather than a share. I do not know how to get round this. :( Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/#findComment-596330075 Share on other sites More sharing options...
ziph Posted April 2, 2014 Share Posted April 2, 2014 You can use powershell instead, and make a small script to query space after mounting it. use a scheduled job like sc302 described. Set the job to run as whoever has access to mount. New-PSDrive ?Name ?<free driveletter>? ?PSProvider FileSystem ?Root ?\\<nas name>\<sharename>? Get-Volume <driveletter> | out-file <path to logfile> -append Remove-PSDrive <Driveletter> make sure the account you are running the job as have the rights to do what you need. Link to comment https://www.neowin.net/forum/topic/1205419-mapped-drives-and-service-accounts/#findComment-596343649 Share on other sites More sharing options...
Recommended Posts