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
Solved

powershell

Posted on 2011-09-21
8
864 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 70

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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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 70

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

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

Question has a verified solution.

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

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 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