Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Mapping drives from batch files and scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-03-26
03:34 PM
2013-03-26
03:34 PM
Mapping drives from batch files and scripts
We are a small office with a ReadyNAS NV+ and Win7HP on the desktops. We have one Win7HP machine that acts as a "backup server" and backs up the ReadyNAS nightly.
Trying to script a quick & dirty addition to the backup script that would loop like this:
a. net use * /d /y
b. net use u: \\99.99.99.99\thisuser /u:thisuser password
c. run a sync util to sync u: to this user's storage space on Win7HP backup server
d. repeat
If I manually create the above in a batch file, everything works fine. (However, for many reasons the procedure must be automated and tied into our existing backup script.)
If the script creates the identical batch file and runs it, the first user is logged-in and synchronized, but all subsequent `net use` attempts fail.
Similarly, if the script attempts to map the drive through code, this message is received:
`Unrecognized network error #183`
The above error suggests that the network drive/path is unavailable -- but a net use command typed at the command line using identical parameters is successful.
The "backup server" is a Win7HP box with UAC disabled. When cmd prompt is launched, all windows are preceded by the word: `Administrator: ` -- however, when the script launches a command window to net use the drive, the cmd titlebar lacks that prefix.
Any thoughts / ideas?
Trying to script a quick & dirty addition to the backup script that would loop like this:
a. net use * /d /y
b. net use u: \\99.99.99.99\thisuser /u:thisuser password
c. run a sync util to sync u: to this user's storage space on Win7HP backup server
d. repeat
If I manually create the above in a batch file, everything works fine. (However, for many reasons the procedure must be automated and tied into our existing backup script.)
If the script creates the identical batch file and runs it, the first user is logged-in and synchronized, but all subsequent `net use` attempts fail.
Similarly, if the script attempts to map the drive through code, this message is received:
`Unrecognized network error #183`
The above error suggests that the network drive/path is unavailable -- but a net use command typed at the command line using identical parameters is successful.
The "backup server" is a Win7HP box with UAC disabled. When cmd prompt is launched, all windows are preceded by the word: `Administrator: ` -- however, when the script launches a command window to net use the drive, the cmd titlebar lacks that prefix.
Any thoughts / ideas?
Message 1 of 2
Labels:
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-03-27
03:11 PM
2013-03-27
03:11 PM
Re: Mapping drives from batch files and scripts
Please show the entire batch script that fails just star out the passwords. Also is your nas in domain mode? Is your network in a domain?
Message 2 of 2