creating directories on remote nt machines -> netshareadd ?

hi guys,
I would like to create a directory on another nt machine. currently i use netshareadd and then
move a file there, but i would like to create a directory
first and then copy the file to that directory if this
is possible.

thanks,
markus
boyracerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
What about simply using 'CreateDirectory ( "\\\\server\\shared_vol\\directory", NULL);'?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
boyracerAuthor Commented:
Will try it... I also read the documentation on
CreateDirectory but was not sure if it also
works on remote hosts.

-> So it is required that for example
c: is shared or can I call netshareadd first
instead so that c becomes shared ?
0
jkrCommented:
>>Will try it...

Don't accept answers before trying it! (nope, it'll work ;-)

Perhaps I haven't been clear enough - the directory doesn't necessarily have to be shared 'directly', an admin share (e.g. 'c$') will also work. If you're receiving 'ERROR_ACCESS_DENIED', you'll have to gather the credentials from the remote machine by using 'WNetAddConnection2()', e.g.

    NETRESOURCE nr;

    ZeroMemory  (   &nr,    sizeof  (   NETRESOURCE));

    nr.dwType           =   RESOURCETYPE_DISK;
    nr.lpLocalName      =   L"";
    nr.lpRemoteName     =   "\\\\server\\path";


    dwRes   =   WNetAddConnection2  (   &nr,
                                        "Password",
                                        "User",
                                        0
                                    );

    if  (   dwRes)
        {
            //  error
        }

Caveat: Win9x only uses the name of the logged-on user, specifying a different name does not remedy this. However, specifying a different password is allowed (as the user might have a different one for the network share). See also http://msdn.microsoft.com/library/sdkdoc/network/networks_84z6.htm 
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

boyracerAuthor Commented:
mal kurz auf deutsch ...

ich verstehe es doch aber richtig,
dass ich ein konekt nur zu einem
shared / freigegebenen drive machen kann, oder.

wenn ich also gerne
ein directory "test" unter c:\progra~1\
erstellen moechte muss progra~1 geshared sein !?

kann man denn auch von "aussen" ein
drive sharen wenn es das noch nicht ist ?
-> muesste man dazu die registry eines
remote rechners aendern
(nach RegConnectRegistry zb )

DANKE !
0
boyracerAuthor Commented:
0
jkrCommented:
Sorry fuer die Verspaetung, aber Freitags war immer nur 'internal server error' & ich war krank uebers Wochenende

Im kurzen:

CreateDirectory ( "\\\\server\\c$\\programs\\newdir", NULL);

muss auch tun...

>>kann man denn auch von "aussen" ein
>>drive sharen wenn es das noch nicht
>>ist ?

Ja, klar, mit 'NetShareAdd()'
0
boyracerAuthor Commented:
test
0
boyracerAuthor Commented:
hi,

ich habe es die letzten tage leider vergeblich versucht. leider bekomme ich immer Access denied :-( damit ich verschiedenes ausprobieren
0
boyracerAuthor Commented:
sorry, ich kann hier nix mehr eingeben
bekomme immer server error :-(
0
jkrCommented:
Internal server error - Weil Umlaute unerwuenscht ;-)
0
boyracerAuthor Commented:
ah,

jetzt bekomme ich einen error 1219:
error_session_credential_conflict

macht das mehr sinn ?
(bei benutzung des Administrator accounts
der remote machine)

danke fuer die hilfe,
markus
0
boyracerAuthor Commented:
Hallo JKR,
es funktioniert jetzt.
Grund war eine verkappte NT installation...
Hat ja nur eine Ewigkeit gedauert es rauszufinden...


Vielen Dank,
Gruss aus dem kalt ekligen Mannheim.
0
jkrCommented:
No, prima! Wusste doch, daß es tun muß ;-)

BTW: In Heilbronn isses wettermäßig nich' viel besser...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.