Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

powershell

Posted on 2011-09-21
8
Medium Priority
?
876 Views
Last Modified: 2012-05-12
For now I cannot use GPO to map network drives on users' computers.
So, I need a vbscript or powershell that would go through a list of computers form a text file like computernames.txt and then maps a network drive on all computers in the text file. It cannot use GPO or group membership.

Thanks,
Paul
0
Comment
Question by:pauledwardian
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 12

Expert Comment

by:prashanthd
ID: 36578701
Do you want to map to any specific subfolder on each computer?
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 36578949
> maps a network drive on all computers in the text file.

You can do that, but...

The drive will only be mapped in the context of the user executing the script, and since that's you (not your users), how much benefit is that really?

Chris
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 36579075
Agree. One way to accomplish it is to put an file/shortcut into the Startup folder of each user (or All Users), or change the Run registry key of HKCU to run the script. That would mimic a GPO Login script then.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pauledwardian
ID: 36812811
I need a vbscript or powershell according to my question. Thats the best solution for me now. So, please provide the code if you can help.
"So, I need a vbscript or powershell that would go through a list of computers form a text file like computernames.txt and then maps a network drive on all computers in the text file. It cannot use GPO or group membership."


Thanks,
Paul
0
 
LVL 71

Accepted Solution

by:
Chris Dent earned 1200 total points
ID: 36813279
You could have asked for more detail on Qlemo's solution, that's going to be easiest if you need to map the drive for a bunch of users on the computer. It won't be immediately effective and will require a log-off / on (or your users will have to click on something), I don't think we can get around that one.

What you ask, in its pure form, while it sounds simple is exceptionally difficult to do. That is, we can't do this (psuedo-code, don't try it :)):
Get-TheListOfComputers | ForEach-Object { Map-ADrive "B:" "\\Somewhere\share" Computer }

Open in new window

If we did, you'd end up with you logged on to each and every machine, with a nice drive mapping under your user account. I imagine you're not using all the computers at once and kind of need that mapped for whoever is using it?

If the mapping is entirely generic, not at all user specific, you could cheat a bit and dump the batch file in the All Users version of Start-up rather than targeting specific users. Either way, I recommend avoiding HKCU because that introduces figuring out the intended user, and loading / accessing the right hive from HKEY_USERS.

Given that the answer to your question isn't so clear cut, you will have to tell us how you want to proceed. I'm sure we can help, both Qlemo and I are very well versed in scripting technologies.

Chris
0
 
LVL 71

Assisted Solution

by:Qlemo
Qlemo earned 300 total points
ID: 36813957
Nice summary, Chris.
The main issue is that the drive mapping needs to be performed on each machine for each user logging in, and even maybe for Scheduled Tasks, Services or the like. As Chris stated, it sounds easy to do, but isn't at all. Since you do not have (or want to use) a GPO, you need something executing each time a user logs in. It isn't sufficient to perform a one-time action for each machine.
0
 

Author Closing Comment

by:pauledwardian
ID: 36928227
Thanks guys.
0

Featured Post

WatchGuard Case Study: Museum of Flight

“With limited money and limited staffing, we didn’t have a lot of choices in terms of what we could do to bring efficiency. WatchGuard played a central part in changing that.” To provide strong, secure Wi-Fi access within the museum, Hunter chose to deploy WatchGuard’s AP120 APs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question