Discussion Locked

Login Scripting The My Documents Folder

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am working on writing a wsh script file to map a drive to a network path(no problem there) and then assign that path to the "My Documents" Folder(problem).
I seem to be having problems getting the folder to hold that path. I find little to no help in the MSDN about assigning paths to special folders but this is what I have so far.

Set net = Wscript.CreateObject("WScript.Network")
Set wshShell = Wscript.CreateObject("WScript.Shell")

User = net.username
Computer = net.ComputerNameDomain = net.UserDomain

localName = "U:"
net.RemoveNetWorkDrive localName
RemoteName = "\\Server01\d\documents"
UpdateProfile = False

TargetLocation = net.MapNetworkDrive localName, RemoteName, UpdateProfile

WshShell.SpecialFolders.item(MyDocsPath) = TargetLocation

Any ideas would be greatly appreciated.

Thanks
Tim

4 replies

by lexingtonit

I believe you could achieve your goal by using wshshell's regwrite methods, just find out where your "My document" is in your registry. My OS is NT, I don't have that.

Willy

by code slammy

After a little more research after my initial post that was the same conclusion I came to. I tried it and it worked well. Thanks for the response lexingtonIT.

This discussion is closed to new replies.