Solved

net user command

Posted on 2011-09-24
5
457 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
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…

910 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

20 Experts available now in Live!

Get 1:1 Help Now