I know how to map a network shared drive use the NET USE command, but I can’t figure out how to use it in this specific condition.
e.g. The network path is \share\users\ganda. In the users directory, there already many sub-directories created, but I want to create a simple script that uses the NET USE command to map a drive based on the user account name that’s logged on.
If my NT username is ganda, of course I can simply map it to drive z as an example:
net use z: \\share\users\ganda
But I don’t want to “hard code” it so that it can be used for any username that logs in to that matches the directory. Maybe I need to define the username logged in as a variable to match it? I know this is kind of hard to picture, but any help is appreciated.
Just an idea: have you tried defining home directories for users, on the server instead?
Anyway, maybe you shouldn’t bother too much. Don’t know if it’s related with your question, but I’d like to share an experiment I did Friday at the office: I’ve installed a small distro of Linux on an USB stick, made it bootable, started it on my computer. Let me tell you I was able to see and modify with SAMBA all files (including admin shares and all) from the computers on our small office LAN.
Just give it a try if you have some spare time. It took me about 10 minutes.
Linux is N/A for my situation.
How is that done? (:NRD)
If there’s a command that returns the username or profile that’s currently logged in, and I can use that text in the context of the net use command, that might be the way. Or maybe I am over-complicating this.
Wouldn’t “net use z: \share\users%username%” work, providing there was a folder with the corresponding username already in existence?
You’re a genius, Ewen :-TU. Thanks :).
I have marked this resolved (:m*)
You’re sharing things with Ganda? I’m painting a mental picture and pray that God will take these crayons from me.
Ganda’s name was used in vain, but that was intentional for humourous effects :D.