sgiri
asked on
startup script to access mapped drive
Hi,I need to access a shared folder from the domain server,as my pc in the work group,whenever i try to access the folder it asks for the username and password to access the shared resources.I am planning to map that folder in my pc and i want to give some startup scripts which automatically run whenever the pc logsin.so that i do not require to put the credentials everytime.Please advice some easy steps which i can use to do this task as i am not in to software programming.
If you set the workgroup to the same name as the domain, and create a domain account with the same credentials as your local PC account, it wont ask you for a password either.
It is isn't even necessary to have the same workgroup name as the domain name, as long as the server is the domain controller. DCs will automatically apply their domain, if the domain part of a credential is invalid (in most cases, at least). However, having the workgroup name the same makes things much more easy.
That's another way to do it. Remember to have the "Reconnect" checkbox ticked.
ASKER
Hi Greg,I tried by mapping the drive with a different username,but after the reboot when i try to access the mapped drive it is asking to enter the password.
You need to assign a drive letter for the mapping to be permanent. It does not matter if you use the drive letter later, but the persistent drive settings apply only to mapped drives (as opposed to UNC paths).
ok
this is plan b
open a command prompt change i to the drive letter and change the path
it should ask for a username and password and store them.
net use i: \\ComputerName\ShareName /savecred
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx?mfr=true
this should explain a bit more.
Greg
this is plan b
open a command prompt change i to the drive letter and change the path
it should ask for a username and password and store them.
net use i: \\ComputerName\ShareName /savecred
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx?mfr=true
this should explain a bit more.
Greg
... see http:#a29544012
ASKER
Hi Greg,I am using the command like this which i found in one of the article.
net use S:(Drive Letter to Map) "\\ECC\ECC-S-SHARED(Share Name)" test(password) /USER:abc\test(domain\user name) /persistent:no
the above command gives me error message as conflict with switches and i am not sue abt why persistent is used here.
net use S:(Drive Letter to Map) "\\ECC\ECC-S-SHARED(Share Name)" test(password) /USER:abc\test(domain\user
the above command gives me error message as conflict with switches and i am not sue abt why persistent is used here.
Please try the /savecred version. /persistent:no is what you want not to use.
if you use the /savecred it will ask for the username and password and save them
next time you map the drive it should know the username and password.
Also
The above command should look more like
net use S: \\ECC\ECC-S-SHARED /USER:abc\test test /persistent:yes
Greg
next time you map the drive it should know the username and password.
Also
The above command should look more like
net use S: \\ECC\ECC-S-SHARED /USER:abc\test test /persistent:yes
Greg
ASKER
Hi greg,the below command is working for me,but i need to know where to give the savecred
net use r: \\computername\sharename password /USER:dotteddomainname\use rname /persistent:yes
net use r: \\computername\sharename password /USER:dotteddomainname\use
You can either provide the credentials in net use, as you've done above, or interactively with /savecred, but not both. That is, if you use /savecred, you can't use /user (and password).
BTW, would you please mind reading my first post? All said up to know has already been said there.
ASKER
Hi Olema,if i use the command i getting the below error mesg.
C:\>net use x: \\pc008\common /savecred /persistent:yes
A command was used with conflicting switches.
More help is available by typing NET HELPMSG 3510.
C:\>net use x: \\pc008\common /savecred /persistent:yes
A command was used with conflicting switches.
More help is available by typing NET HELPMSG 3510.
open this in explorer
C:\Documents and Settings\All Users\Start Menu\Programs\Startup
create a new text file and change the name to map r.bat
copy and paste this into the file
@echo off
echo *** Map R drive Script ***
net use r: /del
r: \\computername\sharename password /USER:dotteddomainname\use rname /persistent:yes
Does this map the drive without a password?
Greg
C:\Documents and Settings\All Users\Start Menu\Programs\Startup
create a new text file and change the name to map r.bat
copy and paste this into the file
@echo off
echo *** Map R drive Script ***
net use r: /del
r: \\computername\sharename password /USER:dotteddomainname\use
Does this map the drive without a password?
Greg
The above will load at startup for all users and try to map the r drive.
Greg
Greg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Olemo,Yes your correct the commond which you gave in the first post works fine,actually my question was not proper,sorry for that.
1.I tested with a shared folder which has everyone rights it is working fine.
fyi...after given the said command
C:\>net use x: \\pc008\common /savecred /persistent:yes
I am getting the message as mapping done successfully,i didn't asked for the username or password.
2.If i use the same command for the folder which i do not have any rights,i am getting the error message as below.
"A command was used with conflicting switches"
Please note i am using a pc which is in workgroup and i am the administrator for the domaincontroller and i have domai n admin credentials to access the folder.but while mapping it is not asking for any credentials.please help.
1.I tested with a shared folder which has everyone rights it is working fine.
fyi...after given the said command
C:\>net use x: \\pc008\common /savecred /persistent:yes
I am getting the message as mapping done successfully,i didn't asked for the username or password.
2.If i use the same command for the folder which i do not have any rights,i am getting the error message as below.
"A command was used with conflicting switches"
Please note i am using a pc which is in workgroup and i am the administrator for the domaincontroller and i have domai n admin credentials to access the folder.but while mapping it is not asking for any credentials.please help.
what happens if you start run and put the unc path in.
Does it ask for new credentials?
Greg
Does it ask for new credentials?
Greg
ASKER
yes Greg,it opens only if i give domain admin credentials.Regards
if you use net use x: \\pc008\common /savecred
does it ask for credentials?
Greg
does it ask for credentials?
Greg
ASKER
No it does not ask for credentials it immediately gives me the sucessfull message.
Then the credentials have already been saved.
Just use that command in a script and add it to your startup folder and you will always have the drive mapped.
To do this use instructions from above but put your start up folder here
C:\Documents and Settings\your username\Start Menu\Programs\Startup
and use the command that worked.
Greg
Just use that command in a script and add it to your startup folder and you will always have the drive mapped.
To do this use instructions from above but put your start up folder here
C:\Documents and Settings\your username\Start Menu\Programs\Startup
and use the command that worked.
Greg
Yes, you need to apply that command in each user profile. You cannot do that once and for all as an admin, net use is valid only for an individual and current user.
And credentials are only asked if you do not have a mapping to the same server already, BTW.
ASKER
As i said earlier,if i try to map the folder which i do not have rights,i am getting error message. "A command was used with conflicting switches"
but if i try to map the folder which i have rights it's working fine.
but if i try to map the folder which i have rights it's working fine.
??? What do you expect ??? You have no rights, so why map it? While the message is confusing, you can't map the drive anyways. If you want an "error-free" mapping, that is silently discarding mapping on folders without rights, add a 2>nul to the command:
net use x: \\pc008\common /savecred 2>nul
Usually, if you have to map several drives with different shares on the same server, you first do a IPC$ share:
net use \\pc008 /savecred
followed by your intended mappings, without credentials, as they are already provided by the command above:
net use x: \\pc008\common
net use y: \\pc008\private
net use * \\pc008\ChangingDriveLette r
net use x: \\pc008\common /savecred 2>nul
Usually, if you have to map several drives with different shares on the same server, you first do a IPC$ share:
net use \\pc008 /savecred
followed by your intended mappings, without credentials, as they are already provided by the command above:
net use x: \\pc008\common
net use y: \\pc008\private
net use * \\pc008\ChangingDriveLette
ASKER
sorry for that, the requirement is.
I have a DC @ location "A" and DC @ location "B",both the DC's working independently.but the network is connected with site 2 site.
From location "A" if i try to access the folder from location "B" which doesn't have rights for the user of location "B" server.
If I use $sign and give the admin credentials i will be able to access the folder manually,
but i want to map this permanently even if the server reboots the map should reconnect automatically.
Regards
giri
I have a DC @ location "A" and DC @ location "B",both the DC's working independently.but the network is connected with site 2 site.
From location "A" if i try to access the folder from location "B" which doesn't have rights for the user of location "B" server.
If I use $sign and give the admin credentials i will be able to access the folder manually,
but i want to map this permanently even if the server reboots the map should reconnect automatically.
Regards
giri
That does not make it more clear. You really want to have all users on "A" to use admin shares ($'s) on "B"? That will indeed only work with an admin account. And then they can access anything on that server. That is nothing I would want to do.
ASKER
Thanks
net use x: \\server\share /u:MyUser MyPassword /persistent:no
Create that file, and drag it in Explorer to your Startup folder using the start menu (that will create a link).
3. would be implemented by issuing in a Command Prompt or Run box:
net use x: \\server\share /savecred /persistent:yes
Then type your user and password, and that should be stored for all times for this user.