create a script

Posted on 2006-06-07
Last Modified: 2012-05-05
Whats the syntax used to create a simple script that creates  the following

Question by:cogit
    LVL 23

    Expert Comment

    are you wanting to create that user's folder or what?
    LVL 2

    Expert Comment

    mkdir \\computername\share$\%username%

    That will create a folder under the network directory share$ with the user's name for the folder name.

    Or if you're trying to map a network drive it would be:

    net use h: \\computername\share$\%username%

    Hope this helps.

    LVL 23

    Expert Comment

    Todd's answer is correct if you are talking about creating a simple folder based on the username of the currently logged on user (assuming that user has rights to create a folder on that share).

    I'm still curious what you are trying to accomplish.

    Author Comment

    Because I have 500 users in AD and instead of using the the profile tab for creating home folder path, I would use a .bat to the OU where the users reside.
    LVL 51

    Expert Comment

    All 500 Users can be changed/updated at one time.  Simple select ALL the users, then right-click them and select Properties.  All of the properties that are common to User accounts will be available to change - profile and home drive should be included here.

    Simply add your line:  \\servername\share$\%username%
    LVL 23

    Accepted Solution

    Yep, just as AOD has said...

    Otherwise like Todd said, you can do:

    @echo off
    Net Use H: /del
    Net Use H: \\server\users\%username% /persistent:no

    Save that as the batch file for the login script.

    That would make sure that the H drive is deleted if someone has mapped it to something else, then it maps the drive again.
    LVL 23

    Expert Comment

    Thanks for the points but....technically Todd answered it first, and AOD gave you a solution as well, so maybe a points split is in order?  Up to the author of course, but I don't feel right just adding to another answer.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
    I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now