Solved

powershell

Posted on 2011-09-21
8
865 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 69

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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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 69

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
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).
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ā€¦

740 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