Function Reference


Connects a local device to a network resource

#include <WinNet.au3>
_WinNet_AddConnection2 ( $sLocalName, $sRemoteName [, $sUserName = 0 [, $sPassword = 0 [, $iType = 1 [, $iOptions = 1]]]] )


$sLocalName Name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a
case-insensitive manner. If the Null keyword or an empty, a connection to the network resource is made without redirecting the local
$sRemoteName Name of the network resource to connect to
$sUsername [optional] User name for making the connection. If 0, the function uses the default user name.
$sPassword [optional] Password to be used to make a connection. If 0, the default password is used. If the string is
empty, no password is used.
$iType [optional] Specifies the type of network resource to connect to:
    0 - Any (only if $sLocalName is 0)
    1 - Disk
    2 - Print
$iOptions [optional] Connection options. Can be one or more of the following:
    1 - The network resource connection should be remembered
    2 - The operating system may interact with the user for authentication purposes
    4 - The system not to use any default setting for user names or passwords without offering the user the
        opportunity to supply an alternative. This flag is ignored unless bit 2 (interactive) is also set.
    8 - Forces the redirection of a local device when making the connection
    16 - The operating system prompts the user for authentication using the command line instead of a GUI.
        This flag is ignored unless bit 2 (interactive) is also set.
    32 - If this bit is set, and the operating system prompts for a credential, the credential is saved by the credential manager.
        If the credential manager is disabled for the caller's logon session, or if the network
        provider does not support saving credentials, this flag is ignored.
        This flag is also ignored unless you set
bit 5 (command line instead of GUI).

Return Value

Success: True.
Failure: False.


_WinNet_AddConnection, _WinNet_AddConnection3

See Also

Search WNetAddConnection2 in MSDN Library.