Solved

net user command

Posted on 2011-09-24
5
461 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

696 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