Recommended Posts

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

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.

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.

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. 

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?

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

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.

This topic is now closed to further replies.
  • Posts

    • I am not a fan of haptic feedback touchpads. I've owned a Surface Laptop 7 (Snapdragon) with one and a Lenovo Slim (Intel), and I hated both to the point where I purchased different laptops. It's not that they don't work most of the time; it's that they don't work 100% of the time, and there is no advantage from a user's perspective over a good mechanical trackpad like what's on a ThinkPad X1 or a Yoga 9i. I do not believe that I'll buy another haptic feedback touchpad laptop again in the near future.
    • Works fine here too. About this build, I don't like to download any kind of Windows, from any site except Microsoft. The mod might work, but I don't know what it's inside. Can contain malware, backdoors... Long time ago I've used something like this but reversed - it was 98se with the look and some functionality  of XP. Or, later XP with Vista look. But I made it myself. Not downloaded from obscure sites.
    • Rockstar gives last-gen GTA V players free upgrades tomorrow by Pulasthi Ariyasinghe Rockstar is preparing to launch Grand Theft Auto VI later this year, but ahead of that, the company has revealed a new offer for some Grand Theft Auto V owners. It today announced that Xbox One and PlayStation 4 version owners of the 2013-released title will soon be receiving a free upgrade to the current generation version. The studio released the Xbox Series X|S and PlayStation 5 version of Grand Theft Auto V back in 2022, bringing significant upgrades to the original console editions. This included 60 FPS gameplay at up to 4K resolution, as well as major upgrades to textures, draw distance, and audio. Faster load times, ray tracing elements, and HDR support were also added with it. While this new and enhanced version needed a new purchase of the game to jump in, now Rockstar has decided to make it a free upgrade, dropping the $40 price tag entirely on consoles. "Beginning tomorrow, those who own any PS4 version or the digital Xbox One version of Grand Theft Auto V will be able to upgrade to the PS5 or Xbox Series X|S versions at no additional cost, and experience the best versions of GTA V and GTA Online," said the company in an official blog post. The free upgrade offer will be released tomorrow, June 18, for all Xbox One and PlayStation 4 owners of Grand Theft Auto V. Players who will be jumping in on the offer will want to check how to migrate their GTA Online profile from last-generation to current-generation consoles by heading over here. The offer lands ahead of The Kortz Center Heist hitting Grand Theft Auto Online, where players and crews will be tasked with stealing priceless international art from a prestigious gallery in Pacific Bluffs. It doesn't look like Rockstar plans to stop updating its previous game even with Grand Theft Auto VI being on the horizon. The latest title is slated to launch on November 19, 2026, across Xbox Series X|S and PlayStation 5.
    • Now comes with a money back guarantee instead of a replacement! Hah
  • Recent Achievements

    • One Month Later
      Vincian earned a badge
      One Month Later
    • First Post
      Jocimo earned a badge
      First Post
    • Week One Done
      suprememobiles48 earned a badge
      Week One Done
    • One Month Later
      Windows Guy earned a badge
      One Month Later
    • One Month Later
      Prasann earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      511
    2. 2
      +Edouard
      172
    3. 3
      PsYcHoKiLLa
      89
    4. 4
      Steven P.
      76
    5. 5
      neufuse
      69
  • Tell a friend

    Love Neowin? Tell a friend!