?
Solved

net user command

Posted on 2011-09-24
5
Medium Priority
?
462 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 300 total points
ID: 36592418
net use /d * /y
0
 
LVL 16

Accepted Solution

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

 net use /d /y *
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 100 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

800 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