0

I am using a batchscrip to run at logon on my server 2012 essentials Domain Controller...

The script breaks down into 3 sections

  • Connects to 2 folders in local PC share
  • Connects to remote ip (wan ip) server shares
  • Connects to local up (lan ip) server shares...

This works great however ideally I would like it to do on or the other of the bottom steps, so connect ideally first by using the local server IP, and if this fails as a fall back connect using the

@echo off

:DELETE
net use /delete * /y

:SHAREA
NET USE u: "\\ComputerIP\Documents" /user:user password
GOTO SHAREB

:SHAREB
NET USE v: "\\ComputerIP\Documents\Guest Documents" /user:user password
GOTO SHAREC

:SHAREC
NET USE w: "\\RemoteIP\Company\Documents"
GOTO SHARED

:SHARED
NET USE x: "\\RemoteIP\Company\Documents\Guest Documents"
GOTO SHAREE

:SHAREE
NET USE y: "\\localIP\Company\Documents"
GOTO SHAREF

:SHAREF
NET USE z: "\\localIP\Company\Documents\Guest Documents"
GOTO EOF

:EOF
1
  • 1
    Please review your question, as-is it makes little sense. I think you a word or two. Commented Feb 19, 2015 at 5:14

1 Answer 1

0

If you want to do a "net use" on server1 first and if that fails do "net use" on server2 you can probably do something like this:

NET USE X: \\Server1\share
IF NOT EXIST X:\ (
   NET USE X: \\Server2\share
)
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .