Link to home
Start Free TrialLog in
Avatar of maingateinc
maingateinc

asked on

Logon script error silencing

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
Avatar of oBdA
oBdA

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

SOLUTION
Avatar of Todd Mummert
Todd Mummert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maingateinc

ASKER

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

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

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
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?
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
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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial