Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping home folder

Status
Not open for further replies.

58sniper

MIS
Apr 25, 2004
9,152
US
Greets -

Just curious as to a method to map the HOME folder in vbscript instead of in the AD profile.

Obviously
Code:
WSHNetwork.MapNetworkDrive "h:", "\\server\users$\" & UserName

Should work, but that doesn't set the HOMEDRIVE and HOMEPATH variables. Do I also need to do something like

Code:
Set objEnv = objShell.Environment("User")
objEnv("HOMEDRIVE") = "h:"
objEnv("HOMEPATH") = "\"

Or is there an easier way to combine the tasks?

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
Anyone?

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
 
This should work as long as you have your directory and share priviledges correct.

Code:
Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")

strUser = WSHNetwork.UserName

WSHNetwork.MapNetworkDrive "h:", "\\Server\users$\" & strUser

Which from your post should be what you are doing. Which would make me suspect either share or directory/file priviledge problems.

Hope this helps

Thanks

John Fuhrman
Titan Global Services
 
I'm having no problems actually mapping the drive and getting the users connected. The problem is that if you specify a drive letter and location in the user's profile, then use
net use h: /home
the user not only gets the drive mapped, but also has the two environment variables updated.

Since I'm switching to vbs, I'm asking what's the best way to set those variables. Just dunno if there is a more efficient way.

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
 
i had to do the same thing when switching to a logonscript which read ini files for config data (reason i had to put env var was for the citrix team)

you will have to code the adding of the environv_var as well. use WMI
 
I see says the blind man!!

This is a snippet from a client install that I use to setup user envirnment settings.

Code:
Set WshSystemEnv = objShell.Environment("USER")
WshSystemEnv([!]SFWINIPATH[/!]) = "E:\PROGRA~1\CoreDir\Users\" & strUser &_
"\BK" & strBank

The only difference I see is that I don't use the quotes.



Thanks

John Fuhrman
Titan Global Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top