Jump to content



Photo

Mapped drives and Service accounts

windows freenas mapped drives

  • Please log in to reply
7 replies to this topic

#1 Daedroth

Daedroth

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 15-June 11
  • Location: UK

Posted 18 March 2014 - 15:34

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?




#2 +BudMan

BudMan

    Neowinian Senior

  • Tech Issues Solved: 85
  • Joined: 04-July 02
  • Location: Schaumburg, IL
  • OS: Win7, Vista, 2k3, 2k8, XP, Linux, FreeBSD, OSX, etc. etc.

Posted 19 March 2014 - 15:18

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.



#3 OP Daedroth

Daedroth

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 15-June 11
  • Location: UK

Posted 21 March 2014 - 08:01


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.



#4 sc302

sc302

    Neowinian Senior

  • Tech Issues Solved: 23
  • Joined: 12-July 05
  • Location: NJ, USA

Posted 21 March 2014 - 13:10

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. 



#5 OP Daedroth

Daedroth

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 15-June 11
  • Location: UK

Posted 23 March 2014 - 09:16

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?



#6 sc302

sc302

    Neowinian Senior

  • Tech Issues Solved: 23
  • Joined: 12-July 05
  • Location: NJ, USA

Posted 23 March 2014 - 12:39

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.

#7 OP Daedroth

Daedroth

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 15-June 11
  • Location: UK

Posted 25 March 2014 - 19:36

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. :(



#8 ziph

ziph

    Neowinian

  • Joined: 26-August 09
  • Location: Denmark
  • OS: Win 8.1
  • Phone: Android

Posted 02 April 2014 - 19:12

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.





Click here to login or here to register to remove this ad, it's free!