map network drive

A

Alex

Hi All
I'm writing scripts in VBS fore years. But now I've to
write a tool in Visual Basic .Net which has to connet to a
Windows domain. I know how to do this in VBS but I don't
find a way in VB.Net. I've no idea how to logon to the
domain via Net.Socket. It is not necessary to map a
network drive. I can transfer data via UNC names.

Can anybody give me a suggestion how to realize it?

Thanks in advance

Alex
 
O

One Handed Man \( OHM - Terry Burns \)

System.Diagnostics.Process.Start("Net", "Use N: \\Client1\c$")

HTH


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
A

Alex

Thanks

Thats great.
But I still have the problem to connect to the Domain with
a different account. Do you have also an idea how to
transfer username and password?

Thanks in advance

Alex
 
O

One Handed Man \( OHM - Terry Burns \)

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Terry Burns>net help
The syntax of this command is:


NET HELP
command
-or-
NET command /HELP

Commands available are:

NET ACCOUNTS NET HELP NET SHARE
NET COMPUTER NET HELPMSG NET START
NET CONFIG NET LOCALGROUP NET STATISTICS
NET CONFIG SERVER NET NAME NET STOP
NET CONFIG WORKSTATION NET PAUSE NET TIME
NET CONTINUE NET PRINT NET USE
NET FILE NET SEND NET USER
NET GROUP NET SESSION NET VIEW

NET HELP SERVICES lists some of the services you can start.
NET HELP SYNTAX explains how to read NET HELP syntax lines.
NET HELP command | MORE displays Help one screen at a time.

C:\Documents and Settings\Terry Burns>net help us
The syntax of this command is:


NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |
SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]



The keyword NET specifies Windows commands.

NET HELP command | MORE displays Help one screen at a time.

C:\Documents and Settings\Terry Burns>net use /help
The syntax of this command is:


NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]


NET USE connects a computer to a shared resource or disconnects a
computer from a shared resource. When used without options, it lists
the computer's connections.

devicename Assigns a name to connect to the resource or specifies
the device to be disconnected. There are two kinds of
devicenames: disk drives (D: through Z:) and printers
(LPT1: through LPT3:). Type an asterisk instead of a
specific devicename to assign the next available
devicename.
\\computername Is the name of the computer controlling the shared
resource. If the computername contains blank characters,
enclose the double backslash (\\) and the computername
in quotation marks (" "). The computername may be from
1 to 15 characters long.
\sharename Is the network name of the shared resource.
\volume Specifies a NetWare volume on the server. You must have
Client Services for Netware (Windows Workstations)
or Gateway Service for Netware (Windows Server)
installed and running to connect to NetWare servers.
password Is the password needed to access the shared resource.
* Produces a prompt for the password. The password is
not displayed when you type it at the password prompt.
/USER Specifies a different username with which the connection
is made.
domainname Specifies another domain. If domain is omitted,
the current logged on domain is used.
username Specifies the username with which to logon.
/SMARTCARD Specifies that the connection is to use credentials on
a smart card.
/SAVECRED Specifies that the username and password are to be saved.
This switch is ignored unless the command prompts for
username
and password. This option is not available on Windows XP
Home Edition and will be ignored.
/HOME Connects a user to their home directory.
/DELETE Cancels a network connection and removes the connection
from the list of persistent connections.
/PERSISTENT Controls the use of persistent network connections.
The default is the setting used last.
YES Saves connections as they are made, and restores
them at next logon.
NO Does not save the connection being made or subsequent
connections; existing connections will be restored at
next logon. Use the /DELETE switch to remove
persistent connections.
NET HELP command | MORE displays Help one screen at a time.

C:\Documents and Settings\Terry Burns>

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
P

Paul Clement

¤ Hi All
¤ I'm writing scripts in VBS fore years. But now I've to
¤ write a tool in Visual Basic .Net which has to connet to a
¤ Windows domain. I know how to do this in VBS but I don't
¤ find a way in VB.Net. I've no idea how to logon to the
¤ domain via Net.Socket. It is not necessary to map a
¤ network drive. I can transfer data via UNC names.
¤
¤ Can anybody give me a suggestion how to realize it?

I would recommend using the API function calls:

http://makeashorterlink.com/?H39D124E8


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top