Solved

net user command

Posted on 2011-09-24
5
459 Views
Last Modified: 2012-05-12
Hi EE,

I have a particular batch file with the following net use commands:

net use /d *
net use F: \\w2k\Finance
net use M: \\w2k\Marketing
net use S: \\w2k\Sales
net use V: \\w2k\CustomerService

If I manually ran the batch file, the batch file will pop up with the below question. I want to add another command to say YES to that question: What command woud it be?


'\\w2k\netuser'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.

C:\Windows>net use /d *
You have these remote connections:

    F:              \\srv-dc\Finance
    M:              \\w2k\Marketing
    S:              \\w2k\Sales
    V:              \\w2k\CustomerService
Continuing will cancel the connections.

Do you want to continue this operation? (Y/N) [N]:


Thanks heaps
0
Comment
Question by:mcse2007
5 Comments
 
LVL 13

Assisted Solution

by:5g6tdcv4
5g6tdcv4 earned 75 total points
ID: 36592418
net use /d * /y
0
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 150 total points
ID: 36592427
you may use

 net use /d /y *
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 25 total points
ID: 36592431
Hi, try adding:
openfiles /disconnect /id *

to the top (but don't run it on a server!!)

Or, if you wanted to use VBScript, you can use this:
Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemoveNetworkDrive "F:", True, True
objNetwork.RemoveNetworkDrive "M:", True, True
objNetwork.RemoveNetworkDrive "S:", True, True
objNetwork.RemoveNetworkDrive "V:", True, True
WScript.Sleep 3000
objNetwork.AddNetworkDrive "F:", "\\srv-dc\Finance", True
objNetwork.AddNetworkDrive "M:", "\\w2k\Marketing", True
objNetwork.AddNetworkDrive "S:", "\\w2k\Sales", True
objNetwork.AddNetworkDrive "V:", "\\w2k\CustomerService", True

Open in new window


Regards,

Rob.
0
 
LVL 42

Expert Comment

by:kevinhsieh
ID: 36592904
It is better if you start using group policy preferences for drive mapping instead of logon scripts. See

http://blogs.technet.com/b/grouppolicy/archive/2009/02/11/gp-preferences-will-reduce-logon-scripts-mapping-drives.aspx
0
 
LVL 7

Author Closing Comment

by:mcse2007
ID: 36593218
appreciated the help.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

831 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