Solved

net user command

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
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…

758 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

27 Experts available now in Live!

Get 1:1 Help Now