Solved

Logon script error silencing

Posted on 2009-05-19
9
539 Views
Last Modified: 2012-05-07
Hello, I'm not the most experienced with logon scripts.  I would like our script to remove any mapped network drives with the letters p through z each time a user logs on.  However with the script as follows I end up flooding the majority of end users with a bunch of ERROR 2250's when the mapped network drive doesn't exist at logon.  Here's how I have it written:

net use p: /delete
net use q: /delete
net use r: /delete
net use s: /delete
net use t: /delete
net use u: /delete
net use v: /delete
net use w: /delete
net use x: /delete
net use y: /delete
net use z: /delete

How can I disable this bounce-back error reporting each time a drive is not found?
Thanks in advance
0
Comment
Question by:maingateinc
  • 4
  • 3
  • 2
9 Comments
 
LVL 82

Expert Comment

by:oBdA
ID: 24424638
Simply send the errors into the NUL device (and you can do that in a loop, btw):


for %%a in (p q r s t u v w x y z) do net use %%a: /delete >NUL 2>&1

Open in new window

0
 
LVL 11

Assisted Solution

by:climbgunks
climbgunks earned 100 total points
ID: 24424682



net use p: /delete 2>NUL

if there was output on stdout as well , you could use

net use p: /delete >NUL 2>&1


0
 

Author Comment

by:maingateinc
ID: 24424711
Ok I see when I make these changes that I get a response that just says NUL instead of the 2250 ERROR.  Is there a way to disable the response at all?  Or a way to run that part of the script silently?  I tried @ECHO OFF at the top but it didn't work
0
 
LVL 11

Expert Comment

by:climbgunks
ID: 24424756

Can you attach your entire script?   Or create a smaller script that still exhibits the same problem and attach that.    What specific OS version?

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:maingateinc
ID: 24424828
You bet; here it is (wouldnt let me attach as .bat, had to leave it a .txt)

Pushing this out through AD/sysvolume directory on Windows 2003 Server Standard to Windows XP Pro workstations
del-drives.txt
0
 
LVL 82

Expert Comment

by:oBdA
ID: 24424880
Runs just nice and quiet for me.
You might want to add the "@echo off" at the beginning, but other than that, there should be nothing displayed at all.
Does that happen as well when you run the script manually?
0
 

Author Comment

by:maingateinc
ID: 24424935
Hmm yes whether I have it in the script or run it manually we get the following window that appears with a sleu of message lines
ss.JPG
0
 

Author Comment

by:maingateinc
ID: 24424970
Well @echo off wasn't working before, like I said, but with the new command string from above combined with @echo off it ran silently!  Thanks guys
0
 
LVL 82

Accepted Solution

by:
oBdA earned 400 total points
ID: 24424972

@echo off

for %%a in (p q r s t u v w x y z) do net use %%a: /delete >NUL 2>&1
 
 

Alternative, if you want to stay with a single line:

@for %%a in (p q r s t u v w x y z) do @net use %%a: /delete >NUL 2>&1

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

708 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

18 Experts available now in Live!

Get 1:1 Help Now