Solved

powershell

Posted on 2011-09-21
8
872 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 70

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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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 400 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 70

Assisted Solution

by:Qlemo
Qlemo earned 100 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

Ready to trade in that old firewall?

Whether you need to trade-up to a shiny new Firebox or just ready to upgrade from whatever appliance you're using now, WatchGuard has the right appliance for you! Find your perfect Firebox today with appliance sizing tool!

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
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 antispam), the admini…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

636 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