Results 1 to 4 of 4

Thread: Problem of user creation or folder sharing

  1. #1
    Join Date
    Sep 2009
    Posts
    177

    Problem of user creation or folder sharing

    I have a problem with my .bat file. Well it creates my account and folder but do not share! Should I also connect the network drive? How do I know it's net use but how to integrate them into the .bat?

    Here is the program:

    Code:
    @echo off
    set domain=corvac
    set disk=d:
    set path=%disk%\me
    set user=%1
    set pass=%2
    echo -----------------------------------------
    echo Creation of personal user folder
    echo -----------------------------------------
    ::
    if "%user%"=="" set /p user=Enter the user name : 
    if "%pass%"=="" set /p password=Enter the password :
    ::
    echo.
    if exist %path%\%user%\*.* goto USER_OK
    echo -- Creation of personal folder of %user%
    pause :
    ::
    echo creation of personal folder
    ::
    mkdir d:\me\%user%\ 
    net user %user% %password% /ADD /passwordchg:no /scriptpath:logon.bat 
    net share %user%=%chemin%\%user% /unlimited 
    attrib +h %path%\%user% 
    ::d:\me\%user%\profil /e /s 
    ::
    pause :
    echo Definition of Ownership
    REM call subinacl /subdirectories %path%\%user% /owner=%domain%\%user%
    ::
    ::
    echo -- Assignment of Rights
    echo.
    ::
    :: Modification of permissions NTFS :
    :: The user has access to shared
    :: The administrator also
    subinacl /Share %user% /grant=%domain%\%USER%=F
    subinacl /Share %user% /grant=%domain%\administrator=F
    ::
    ::
    :: Compte "Everyone" : supprimer
    cacls %path%\%user% /R "Everyone" /E
    ::
    :: Assignment of Rights for administrators : Control total
    cacls %path%\%user% /g %domain%\administrator:F /E /t
    ::
    :: Assignment of rights for the user :
    :: 
    cacls %path%\%user% /g %domain%\%user%:F /E /t
    ::
    ::
    ::
    ::
    pause :
    echo.
    echo -- Process term
    echo.
    GOTO FIN
    :USER_OK
    echo.
    echo A file of that name already exists !
    echo Check the username.
    echo.
    ::
    :FIN

  2. #2
    Join Date
    Nov 2008
    Posts
    1,054

    Re: Problem of user creation or folder sharing

    Code:
    net use [{DEVICE | *}] [\\COMPUTER\SHARE[\VOL]] [{PASSWORD | *}]] [/USER:[DOMAIN\]USER] [/USER:[DOTTEDDOMAIN\]USER] [/USER: [USER@DOTTEDDOMAIN] [/SAVECRED] [/SMARTCARD] [{/DELETE | /PERSISTENT:{yes | no}}]
    
    net use [DEVICE [/HOME[{PASSWORD | *}] [/DELETE:{yes | no}]]
    
    net use [/PERSISTENT:{yes | no}]
    DEVICE : Assigns a name to connect to the resource or specifies the device to be disconnected. There are two kinds of device names: disk drives (that is, D: through Z:) and printers (that is, LPT1: through LPT3:). Type an asterisk (*) instead of a specific device name to assign the next available device name.

    \\COMPUTER\SHARE : Specifies the name of the server and the shared resource. If COMPUTER contains spaces, use quotation marks around the entire computer name from the double backslash (\\) to the end of the computer name (for example, "\\Computer Name\Share Name"). The computer name can be from 1 to 15 characters long.

    \VOL : Specifies a NetWare volume on the server. You must have Client Service for NetWare installed and running to connect to NetWare servers.

    PASSWORD : Specifies the password needed to access the shared resource. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when you type it at the password prompt.

    /USER : Specifies a different user name with which the connection is made.

    DOMAIN : Specifies another domain. If you omit DOMAIN, net use uses the current logged on domain.

    USER : Specifies the user name with which to log on.

    DOTTEDDOMAIN : Specifies the fully-qualified domain name for the domain where the user account exists.

    /SAVECRED : Stores the provided credentials for reuse.

    /SMARTCARD : Specifies the network connection is to use the credentials on a smart card. If multiple smart cards are available, you are asked to specify the credential.

    /DELETE : Cancels the specified network connection. If you specify the connection with an asterisk (*), all network connections are canceled.

    /PERSISTENT:{yes | no} : Controls the use of persistent network connections. The default is the setting used last. Deviceless connections are not persistent. Yes saves all connections as they are made, and restores them at next logon. No does not save the connection being made or subsequent connections. Existing connections are restored at the next logon. Use /DELETE to remove persistent connections.

    /HOME : Connects a user to the home directory.

    net help command : Displays help for the specified net command.

  3. #3
    Join Date
    Sep 2009
    Posts
    177

    Re: Problem of user creation or folder sharing

    I could not understand it but I'll try to use the various options described in the 2nd to understand the first ..

  4. #4
    Join Date
    Nov 2008
    Posts
    1,054

    Re: Problem of user creation or folder sharing

    It's not so complicated. If your user already has rights over your share, simply attach the resource to a drive:
    "net use H:\\myserver\MyShare"
    If you're not sure that H is free, the first free drive:
    "net use *\\myserver\MyShare"
    If your user account must be set to one area but not one on which it is:
    add to the previous: /USER thefield\theAccount
    to which the reader is permanent add /persistent: yes
    to save the user/pass supplied add /SAVECRED

    It should take only the 1st order, the second is to transfer a drive, the third, forget it

Similar Threads

  1. Sharing a folder only to a user on another machine
    By Pendres in forum Networking & Security
    Replies: 6
    Last Post: 25-01-2012, 12:49 PM
  2. Creation of the User interface In Android Phones
    By Bihari in forum Portable Devices
    Replies: 4
    Last Post: 02-03-2011, 08:30 AM
  3. Modify file or folder creation date
    By Abode in forum Portable Devices
    Replies: 4
    Last Post: 24-09-2010, 07:35 AM
  4. Replies: 5
    Last Post: 27-01-2009, 07:45 PM
  5. Home folder creation via script
    By CHRITOPHER in forum Active Directory
    Replies: 3
    Last Post: 15-12-2008, 10:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,257,944.72154 seconds with 17 queries