Windows Share Path

vino vino.bheeman at hotmail.com
Sun Dec 3 16:42:46 UTC 2017


On Sunday, 3 December 2017 at 01:27:40 UTC, codephantom wrote:
> On Saturday, 2 December 2017 at 14:23:48 UTC, Vino wrote:
>> Hi,
>>   Even tried the Option "Run with Highest Privilege" but no 
>> luck. and also tried with option "Configure for : Windows 
>> Vista , Windows Server 2008"
>>
>> From,
>> Vino.B
>
> You haven't accidently ticked the 'Do not store password' 
> option? That is a common mistake. (i.e. make sure it's *not* 
> ticked, and reinsert credentials).
>
> In my 'sysadmin' days, I *refused* to use the windows 
> scheduler. I didn't want something that kept changing depending 
> on which version of windows you were using. I wanted 
> consistency.
>
> From memory, i think I installed 'system scheduler' on all my 
> MS servers.
>
> https://www.splinterware.com/tour/scheduler.html

Hi All,

  Finally was able to resolve the issue, the issue was, the 
windows share was mapped using domain user so when the .bat 
program is scheduled via task manager with the option "Run 
whether the user is logged in or not" the .bat script run the 
task in session 0, where as the windows share was mapped in user 
session (domain user , session 23), so the the D program was not 
able to find the windows share path, so add the windows command 
"net use \\server\share" as the first line in the .bat and then 
added line calling the D program which resolved the issue.
Option : Do not store password was unchecked"

Solution:
D Program(TestDir.exe)
import std.stdio;
import std.file;
import std.path;


void main()
{
auto p = "N:\\\\BACKUP";
if (!p.isValidPath && !p.strip.isValidFilename || !p.exists ) { 
writeln("Invalid File Path (", p, ") or Path do not Exist"); }
else { writeln("File Exist":, p); }
}
   }

Bat Program(Run.bat)
@echo off
net use N: \\shareserver\sharename /Persistence: No
start /D D:\DScript /B /WAIT D:\DScript\TestDir.exe
exit

Question:
Is there a way to map network drive in windows using D code, 
similar to the windows command such as "net use" or "pushd" or 
powershell command New-PSDrive.?

From,
Vino.B


More information about the Digitalmars-d-learn mailing list