Adding Batch File to Task

As I asked and someone suggested adding PERSISTENT, I have

net use S: /DELETE
net use S: "\\<device_ip_address>\<share_name>" "<password>" /USER:"<username>" >>C:\tmp\mount.log

Open in new window


Reading Backing Up to a Windows Network Drive, I added this file to C:\tmp and named it mount.bat

Now I could not reboot just yet, but I ran the task, assuming that will add the S: drive, but it did not.  I can re-boot tomorrow once the system has completed another task, but is this correct?

The mount.log that it created is blank

Thank you!
LVL 29
coreybryantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITCommented:
I didn't see any mention of doing a reboot. Just logon the user. Have you tried that?
You can also "<password>" and "<username>" without the quotes.
0
Bill PrewCommented:
Have you run this from the command line in a DOS command window, and if so did it work, or what did it show?

~bp
0
coreybryantAuthor Commented:
@NewVillageIT (NVIT) I can't reboot just yet, the system is running some other tasks so I am still waiting.  I did ot want to sign off / sign back on because I was afraid the tasks would stop (third paragraph from the end)

@Bill Prew - I had doubled clicked on the batch file, but not thru the cmd.  So I opened the CMD prompt:
C:\tmp>net use S: /DELETE
The network connection could not be found.

More help is available by typing NET HELPMSG 2250.

C:\tmp>net use S: "\\192.168.1.132\NSA325" "password" /USER:"username" /PERSISTENT:Y
ES  1>>C:\tmp\mount.log
System error 53 has occurred.

The network path was not found.

Open in new window


Now the suggestion from them is
net use S: /DELETE
net use S: "\\<device_ip_address>\<share_name>" "<password>" /USER:"<username>" >>C:\tmp\mount.log

Open in new window

The
/PERSISTENT:Y

Open in new window

was added so it would not ask me for the password again.

Now, I did change the password / username in my example above.  On the Network, it shows up as NSA325 (This was the name of the device).  Does the name of the share in the batch file need to have a new name?

When I enter 192.168.1.132 in a browser, it takes me to http://192.168.1.132/r44091,/adv,/loginwrap.html, the login screen.

Thank you!
Corey
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Bill PrewCommented:
Based on what you displayed, "\\192.168.1.132\NSA325" is not a valid network sharename.

I suspect this also fails from a CMD prompt:

dir \\192.168.1.132\NSA325

~bp
0
NVITCommented:
Also, in a CMD window, if you type NET VIEW  \\192.168.1.132, or NET VIEW "\\192.168.1.132\NSA325", what results?
0
coreybryantAuthor Commented:
When I used
NET VIEW  \\192.168.1.132

Open in new window

I received this:
C:\Windows\system32>NET VIEW  \\192.168.1.132
Shared resources at \\192.168.1.132

NSA325

Share name   Type  Used as  Comment

-------------------------------------------------------------------------------
admin        Disk
coreybryant  Disk
EBooks       Disk
Library      Disk
Logs         Disk
music        Disk
photo        Disk
public       Disk
RAID1        Disk
Tickets      Disk
video        Disk
Websites     Disk
The command completed successfully.

C:\Windows\system32>

Open in new window

When I typed in
NET VIEW  \\192.168.1.132\NSA325

Open in new window

this error was received:
C:\Windows\system32>NET VIEW  \\192.168.1.132\NSA325
System error 1707 has occurred.
The network address is invalid.
C:\Windows\system32>

Open in new window

As the network image shows, I have a share named NSA325, and I and going by the instructions.

However, I added a 1 to see what would happen, another error:
C:\Windows\system32>NET VIEW  \\192.168.1.132\NSA3251
System error 1707 has occurred.
The network address is invalid.

C:\Windows\system32>

Open in new window

And just to see what help I would get:
C:\Windows\system32>NET VIEW  \\192.168.1.132 /?
The syntax of this command is:
NET VIEW
[\\computername [/CACHE] | [/ALL] | /DOMAIN[:domainname]]

C:\Windows\system32>

Open in new window

0
NVITCommented:
NSA325 is the host name.

The share you're trying to map should be one of those under the "Share name" column.  If not, you need to make a new share which points to the backup folder.

Using the first share from the list as an example:
net use S: "\\192.168.1.132\admin" "password" /USER:"username" /PERSISTENT:YES  1>>C:\tmp\mount.log

Open in new window

0
coreybryantAuthor Commented:
Somehow I lost what I had written. In any event, I sure about the other and left it since it is in the example
net use S: /DELETE
net use S: "\\192.168.1.132\admin" "password" /USER:"username" /PERSISTENT:YES  1>>C:\tmp\mount.log

Open in new window

and it reported this error
C:\tmp>mount
C:\tmp>net use S: /DELETE
The network connection could not be found.
More help is available by typing NET HELPMSG 2250.
C:\tmp>net use S: "\\192.168.1.132\admin" "password" /USER:"username" /PERSISTENT:YE
S   1>>C:\tmp\mount.log
C:\tmp>S:

Open in new window

I say error because the mount.log has: The command completed successfully.
But if I try to enter S:\ enter the browser - it does not work.  
List of drivesYou do not see the drive.

But in the command prompt, I thought I would enter S:
Command PromptAnd you see the drive but when I did dir, the folders did not actually show up what should have been there
NSA325mount.log
0
NVITCommented:
> ...if I try to enter S:\ enter the browser - it does not work
Not certain but a guess... You can't see it because the user browsing in Windows Explorer is a different user. You used a different user to map the drive letter S:. You used "username" "password".

> ...you see the drive but when I did dir, the folders did not actually show up what should have been there
The example I used was just that... an example. I used to to show how to map the drive letter. As I mentioned, you may need to make a new share on host NSA325, which points to the backup folder, wherever that may be. I don't know the specifics how that share is created. Maybe via an online web-based account?
0
Bill PrewCommented:
Okay, there is a lot going on here, so let's try and clear up a few things.

I see a reference to a "mount" command, what is that about, that's not a standard windows command?  Or is that the name of your BAT file?

You are doing this command:

net use S: /DELETE

and getting an error.  That is normal if S: is not assigned.  you might want to use this to suppress any error from this command to avoid confusion:

net use S: /DELETE >NUL 2>&1

You are also using this command:

net use S: "\\192.168.1.132\admin" "password" /USER:"username" /PERSISTENT:YES  1>>C:\tmp\mount.log

That will redirect standard output to the file, but not standard errors, so you likely will not capture errors to the log file.  In addition you are appending to the log file, so you may be getting confused with the content of the file that was actually from a prior execution of the script, not the latest on.

Either delete the log file before running the script, of redirect to it without appending.  So I would suggest:

net use S: "\\192.168.1.132\admin" "password" /USER:"username" /PERSISTENT:YES  >C:\tmp\mount.log 2>&1

While you are debugging this I would add the following to the top, and also bottom of the BAT file.  It will show all drive mappings before, and after your other commands:

net use

As NVIT mentioned, mappings are user specific, so if you want to see mappings in both DOS command sessions, and windows explorer, you need to be using the same user account.

~bp
0
coreybryantAuthor Commented:
http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_28669949.html


@NewVillageIT (NVIT)
Well. I did not want to show my username / password on here, so I did change them.  I also went into the Crashplan GUI to see if it recognized a S: drive, but it did not.

@Bill Prew
Correct, mount.bat is the name of the file, I was just trying to follow as much as I could per the instructions on Backing Up to a Windows Network Drive.  I also tried it on a Windows 7 system, thinking / hoping that it might be better but no, it did not work - so I am working on the Windows 8.1

I am signed on as the same user, so in the mount.bat I have:
net use

net use S: /DELETE

net use S: "\\192.168.1.132\admin" "passwordi" /USER:"username" /PERSISTENT:YES  >C:\tmp\mount.log 2>&1

I think that is what you want me to add / change?
And this is what came up:
C:\tmp>mount

C:\tmp>net use
New connections will be remembered.


Status       Local     Remote                    Network

-------------------------------------------------------------------------------
OK           S:        \\192.168.1.132\admin     Microsoft Windows Network
The command completed successfully.


C:\tmp>net use S: /DELETE
S: was deleted successfully.


C:\tmp>net use S: "\\192.168.1.132\admin" "password" /USER:"username" /PERSISTENT:YE
S   1>C:\tmp\mount.log 2>&1
C:\tmp>

Open in new window


Now, I did change the username / password above so as not show the username / password.  

The mount.log had a new file time, etc but still said: The command completed successfully.
0
Bill PrewCommented:
Oh, so you are trying to back up a network share via CrashPlan?

If so there are special instructions for this.  I looked at these for a while when setting up a backup for my Synology NAS, but then decided to run CrashPlan right on the NAS instead.

http://support.code42.com/CrashPlan/Latest/Backup/Backing_Up_A_Windows_Network_Drive

An important part of this is running the scheduled BAT file at logon for all users.  That way the CrashPlan user will also get the mapping.

~bp
0
coreybryantAuthor Commented:
OK - Sorry, I have been unable to reboot my system because of OneDrive.  They have my accounts messed up and working on that.

We tried this:
net use S: /DELETE
net use S: \\NSA325\admin "password" /USER:"username" /PERSISTENT:YES  >C:\tmp\mount.log

Since NSA325 was already mapped.  And admin is the folder name.
PC InfoWhen I had the other mount.bat, I would get an error that says unable to connect to drive.  
If you look at Crashplan, it does see it now, but it is missing, so we are getting closer
CrashPlan
0
coreybryantAuthor Commented:
I think I got it.  The admin was only looking in a few folders. And the quotations were not needed.

Since I had booted up I typed in (a command prompt running in Admin mode)
net use S: /DELETE
And this was the error message:
The network connection could not be found.
More help is available by typing NET HELPMSG 2250.

So then I typed in
net use S: \\192.168.1.132\ password /USER:username /PERSISTENT:YES  >C:\tmp\mount.log
This error came up
System error 85 has occurred.
The local device name is already in use.

But #CrashPlan can see the drive, but it does not see the folders.  It only see the folders in the Admin folder
•download
•Dropbox
•polkfast
•System Volume
•zyfw
•zy-pkgs
•zy-pkgs
When it should see folders like:
•admin
•Photos
•eBooks
•Videos
•Music
Getting closer here, trying their support forum but I do not see too much activity so hopefully someone will be able to figure it out.
The mount.log was empty.  (I made a copy of the previous one and deleted mount.log so a new one would be created)
0
Bill PrewCommented:
This doesn't seem right, to map a drive you need a shared folder name on the server, and you have only provided a server name, I don't think that will do anything useful.

net use S: \\192.168.1.132\ password /USER:username /PERSISTENT:YES  >C:\tmp\mount.log

~bp
0
coreybryantAuthor Commented:
Bill, you sort of hit the nail on the head.  And you are right. We looked it.
•lost_and_found
•video
•photo
•music
•coreybryant
•EBooks
•Websites
•Logs
•Tickets
Because when I went into the Zyxel NSA325 Control Panel, I saw admin/Dropbox/FromDropbox.

So have to create / map a drive for each share.

I supposed I can do that in one file.  I have eight shares, wondering, if I can put Video, Photo, Music all on one share? What would that do?  I know that all my files are going to be there and that uses Twonky server for the #RokuPlayer.  I will have a lot of videos / photos.  Can I create a share called Media and then put Videos, Music, Photos there?
NSA325 DrivesSo you can see all the folders.  Can I create / run one batch?

I have two examples, and not too sure which one to use:
net use M: /DELETE
net use N: /DELETE
net use O: /DELETE
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 M: \\192.168.1.132\lost_and_found password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use N: \\192.168.1.132\video password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use O: \\192.168.1.132\photo password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use P: \\192.168.1.132\music password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use Q: \\192.168.1.132\coreybryant password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use R: \\192.168.1.132\EBooks password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use S: \\192.168.1.132\Websites password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use T: \\192.168.1.132\Logs password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use U: \\192.168.1.132\Tickets password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1
net use V: \\192.168.1.132\Library password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount.log 2>&1

or
net use M: /DELETE
net use N: /DELETE
net use O: /DELETE
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 M: "\\192.168.1.132\lost_and_found" "password" /USER:"admin" /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-lost.log
net use N: \\192.168.1.132\video password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-video.log
net use O: \\192.168.1.132\photo password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-photo.log
net use P: \\192.168.1.132\music password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-music .log
net use Q: \\192.168.1.132\coreybryant password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-coreybryant.log
net use R: \\192.168.1.132\EBooks password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-Ebooks.log
net use S: \\192.168.1.132\Logs password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-Logs.log
net use T: \\192.168.1.132\Tickets password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-Tickets.log
net use U: \\192.168.1.132\Library password /User:username /PERSISTENT:YES  >C:\Users\Corey\Documents\Batches\mount-Libary.log



And then should I consider running it in Administrative mode?  In C:\Users\Corey\Documents\Batches, I would create admintmount.bat, then click on the Advanced, and click on Run as Administrator.
Adminstrator on mount.batI realize I need to delete the first task / job that I created and add this one.  

But I am not sure which would be the best option?  

Suggestions / changes?  But after we noticed that admin did not have the sub-folders, that was when we knew it had to be something different. Backing Up to a Windows Network Drive, might work one some Network Drives, but not this one.

You might not on the NSA325 Drives, some of the permission types say Advanced or Public.
Share Access ConfigurationThis is because as you can see, I am adding the User Admin
0
Bill PrewCommented:
You could create a new share which is at the root or parent folder of all the other shares you want to be included?  It looks like this would be "RAID1\" in your case.

~bp
0
coreybryantAuthor Commented:
I had that...
Disconnectednet use J: /DELETE
net use J: \\192.168.1.132\RAID1 password /USER:usernam >C:\tmp\mount.log

So I tried running from a Command Prompt:
C:\Windows\system32>net use J: /DELETE
The network connection could not be found.

More help is available by typing NET HELPMSG 2250.


C:\Windows\system32>net use J: \\192.168.1.132\RAID1 password /USER:username >C:\tmp
\mount.log
System error 85 has occurred.

The local device name is already in use.
0
Bill PrewCommented:
And you had actually created RAID1 as a sharename on the SAN?  It looked like that was a device name on the SAN, which wouldn't be recognized from a Windows client.

You can see what shares are available by doing this at a command line:

net view \\192.168.1.132 /all


~bp
0
coreybryantAuthor Commented:
This is what came back:
Shared resources at \\192.168.1.132

NSA325

Share name   Type  Used as  Comment

-------------------------------------------------------
admin        Disk
coreybryant  Disk
EBooks       Disk
Images       Disk
IPC$         IPC            IPC Service (NSA325)
Library      Disk
Logs         Disk
music        Disk
photo        Disk
public       Disk
RAID1        Disk
Tickets      Disk
video        Disk
Websites     Disk
The command completed successfully.

Now, since my problems with OneDrive lately, I wanted to use the coreybryant as a shared folder, create its own username / password

Assuming the above is correct / what you were looking for, do I add another line to the mount.bat file:
net use N: \\192.168.1.132\RAID1\coreybryant password /USER:username  >C:\tmp\mount.log 2>&1
Since I changed it - I didn't take a look to see exactly what Crashplan was backing up, but it (N drive) is being shown on the Crashplan GUI

However, on the Windows browser, it still shows as disconnected.  

If the above would work, I could possibly map a drive thru Windows to that specific folder? Or does the one with a different user / pass require a different drive letter thru mount.bat? And if so, then I could not mount it thru Windows
0
Bill PrewCommented:
RAID1 and coreybryant appear to be peer shares, not nested, so I think you would need to say:

net use N: \\192.168.1.132\coreybryant password /USER:username  >C:\tmp\mount.log 2>&1

You can only map one share to a drive letter though, so that assumes you aren't using N: for anything else.

~bp
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.