[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

drive mappings using net use

Hi

I am trying to redo login script because when this user changed his password (as per the security settings) and logged in, he cannot connect to his mapped drives but instead has to re-enter his password.

Here is the script that someone else wrote

net use s: \\servername\foldername
net use u: \\servername\foldername
net use x: \\servername\foldername
net use h: \\servername\%username%$
w32tm /config /manualpeerlist:ntp3.sf-bay.org /syncfromflags:manual
w32tm /register
w32tm /resync /nowait

My guess why this might be happening is because the drives should be deleted (persistent:no) before being remapped. My question is what does net use h: \\servername\%username%$ mean? Also what does the w32tm.... mean?

If I had to do this I would simply write net use /persistent:no net use s: /delete and so on.

I am not very confident in this stuff, so any help would be greatly appreciate.

Thank you
0
dylanites
Asked:
dylanites
  • 5
  • 2
  • 2
  • +2
1 Solution
 
maxis2cuteCommented:
wm32 is the command to set the time on the computer to whatever is set in group policy. In this case the first line will set it to ntp-Network time protocol. the time server is sf-bay.org.  The second registers it and the third resyncs the time.

the %username% is correct to set it for the current user but the $ i dont know why itis used.
http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=HPND,HPND:2007-27,HPND:en&q=%25username%25%24

0
 
btassureCommented:
The $ indicates that it is a hidden share. If you browse to that location you will not see that folder as being shared in the directory and is only accessible by typing the address directly.
0
 
rhythmluvrCommented:
net use s: \\servername\foldername
net use u: \\servername\foldername
net use x: \\servername\foldername

The above mappings are proper.

net use h: \\servername\%username%$

The above mapping may not be working, the $ may have been a typo when first entered it should only contain %username%, anytime you see a variable encased in % signs it tells the OS to look in the user environment and get the variable specified between the % signs. This can be viewed by opening a dos prompt and typing set, this will list these variables.

w32tm /config /manualpeerlist:ntp3.sf-bay.org /syncfromflags:manual
w32tm /register
w32tm /resync /nowait

The above lines sets the windows time service on each station when they login, specifies the source to go to to sync the time on the workstation, it really only has to be run once, but running each time you login would probably not hurt, considering new stations are probably added occasionally.
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
btassureCommented:
And personally I prefer to delete the mappings before reusing them, though making them not persistent is not really necessary as you are wiping them manually.
0
 
rhythmluvrCommented:
btassure,

good call on the $ symbol, I didn't even think of that.
0
 
maxis2cuteCommented:
I did not even think that they would hide a user share, i would just share only to that user and domain admin and the same with file permissions.

0
 
dylanitesAuthor Commented:
So just to be sure, I should keep the entire script the same, except on the top few lines include net use s /delete and so on to delete the mappings and have them mapped again. I won't explicitly state persistent:no

Also, just out of curioisty is it best practice to include %username%, it seems to me that there is no need for it (especially since all the users who are logging into the domain are getting the same mapped drives).

Thank you
0
 
rhythmluvrCommented:
Without the %username%$ it won't know how to map the user directory, if that's what you want to do.
0
 
dylanitesAuthor Commented:
Okay, so instead of using the home folder option in AD, this person used the %username% in the script?
Thanks
0
 
rhythmluvrCommented:
Perhaps the $ wouldn't work in AD, so he elected to use the login script, just a guess, could be wrong.
0
 
StuFox100Commented:
The %username% is being used and is important.

\\servername\%username%$  means the user is accessing a share that is just theirs. So user1 have \\servername\user1$ and User2 has \\servername\user2$. The $ is important, as with lots of organisations (at least what I have seen) all user shares are hidden.

Second I would move the time script to before the map drives, if you really want to keep it. The significance of this time is to ensure the PC has the same time as the server for authentication, this is important to ensure logons work correctly, there is no point doing this after you authenticate to the server... it is backwards....

While deleting the drives is a good fix and recommended, there may actually be other issues, I would also check the event logs for errors to see if it is working correctly. And also ensure you have the following GPO setting on the machines:

Computer configuration/administrative templates/system/logon

"Always wait for the network at computer startup and logon"

Set to enable.

IF you are using cached passwords it will try to authenticate using the old password not the new, hence having to reenter the password

Cheers
Stu
 
0
 
rhythmluvrCommented:
Probably good to note at this point that the following command will set the workstation clock to the server without using the time service.

net time \\servername /set /yes
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 5
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now