Go Back   Computer Forums > General Computing > Server Administration
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 08-22-2012, 11:37 AM   #1
Daemon Poster
 
Captain Pooka's Avatar
 
Join Date: Oct 2006
Posts: 1,108
Default Mapping drives through GPO

I'm running server 2003, so as you can imagine mapping drives is sort of a pain (so.. it just hasn't been done in the past). I need it done now.

Code:
On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

For Each strGroup in objUser.MemberOf
    strGroupPath = "LDAP://" & strGroup
    Set objGroup = GetObject(strGroupPath)
    strGroupName = objGroup.CN

    Select Case strGroupName
        Case "Pre-KTeachers_Grp"
            objNetwork.MapNetworkDrive "T:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"
        
        Case "KinderTeachers_Grp" 
            objNetwork.MapNetworkDrive "T:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

        Case "FirstGradeTeachers_Grp"
            objNetwork.MapNetworkDrive "T:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

        Case "SecondGradeTeachers_Grp"
            objNetwork.MapNetworkDrive "T:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

	Case "ThirdGradeTeachers_Grp"
            objNetwork.MapNetworkDrive "T:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

	Case "FourthGradeTeachers_Grp"
            objNetwork.MapNetworkDrive "T:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

	Case "FifthGradeTeachers_Grp"
            objNetwork.MapNetworkDrive "T:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

	Case "Administration"
            objNetwork.MapNetworkDrive "S:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

	Case "Quincytestgrp"
            objNetwork.MapNetworkDrive "S:", "\\server\share"
	    objNetwork.MapNetworkDrive "M:", "\\server\share"

    End Select
Next
I started work here last year and the technology portion was in a big mess. I'm still in the process of cleaning up this school district. This VBS was in place, but it never worked. I edited it and customized it, it still doesn't work. Any ideas?

Thanks!
__________________

Captain Pooka is offline   Reply With Quote
Old 08-22-2012, 12:59 PM   #2
Fully Optimized
 
jmacavali's Avatar
 
Join Date: Jun 2009
Posts: 4,867
Default Re: Mapping drives through GPO

This is how it was setup at my school when I got here (also 2003 - welcome to the world of education where we are supposed to prepare the students for the technology they will see in college and the real world but can't afford to upgrade our software to do that).

if InGroup ("Group1")
Use P: "\\server\share1"
Use I: "\\server\share2"
Else
use I: "\\server\share1"
use P: "\\server\share2"
endif

We have this in the netlogon folder on our DC and we have a login.bat file that we set to run on each user in AD and all that .bat file does is call up login.txt which is where this is, along with some other stuff.

Not real sure if it will help or if there is something else that runs as well to make sure it all works....
__________________

__________________
****************************************
Don't take life too seriously -- no one gets out alive. Plus, who wants to arrive to the hereafter in pristine condition wearing a suit and tie?
I want to slide in sideways, worn out, used up, hair a mess, clothes tattered, & screaming, "Whooo! What a ride!"
****************************************
jmacavali is offline   Reply With Quote
Old 08-22-2012, 02:23 PM   #3
Daemon Poster
 
Captain Pooka's Avatar
 
Join Date: Oct 2006
Posts: 1,108
Default Re: Mapping drives through GPO

I don't know if that's the part that's wrong with mine. I guess I could have a bunch of "If" and "End If"s , but I would rather use Case and list the group.

I'll work on if and end if and see what happens.

Someone else have a suggestion?

Thanks for the reply!
Captain Pooka is offline   Reply With Quote
Old 08-28-2012, 12:30 PM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: Mapping drives through GPO

Do you have windows 7 clients?
if you do I'd suggest drive mapping via the use of GPO rather than vbscript.
(much easier to manage)


in other news, there is absolutely nothing wrong with your script.

I've just tested it and it works absolutely fine.
if there is nothing wrong programatically with your script, then there must be something wrong with what you're selecting.

I'd suggest that you throw an echo statement here:

strGroupName = objGroup.CN

wscript.echo strGroupName

Select Case strGroupName
Case "Pre-KTeachers_Grp"


to help you debug.

also bear in mind that the groups are case sensitive, I've also had some troubles getting the case statement to work with group names with spaces in them.
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is online now   Reply With Quote
Old 09-05-2012, 04:03 PM   #5
Daemon Poster
 
Captain Pooka's Avatar
 
Join Date: Oct 2006
Posts: 1,108
Default Re: Mapping drives through GPO

I guess there's something wrong with my GPOs then. This is really bothering me. No one can install anything without typing in admin name/PW. No where in my GPO is this a condition. Also, in my GPO it states NOT to automatically update computers. Well they're all automatically updating anyway. Some even say "Rebooting in 10 minutes to apply updates" and does not give them the option to postpone. It's really making me mad...

Code:
Computer Configuration>Administrative Templates>Windows Components>Windows Update> 

Allow Automatic Updates immediate installation Disabled 
Automatic Updates detection frequency Disabled 
Configure Automatic Updates Disabled 
Enable recommended updates via Automatic Updates Disabled 
Enabling Windows Update Power Management to automatically wake up the system to install scheduled updates Enabled 
No auto-restart with logged on users for scheduled automatic updates installations Enabled 
Re-prompt for restart with scheduled installations Enabled
The plan was to push updates manually all at once. I haven't gotten that far though. There's so much I need to do here ><

Back to the GPO problem:

I would love to manage mapped drives through GPO rather than VBScript, however my coordinator refuses to upgrade our parent DC to the 2008 schema, so we're stuck in 2003. I don't want to use those W7 utilities as I already have this script written up.

I have this script in user configuration>Windows Settings>Scripts>Logon
I have NO idea why it's not taking effect. Even with a gpupdate /force... nothing. I would hate to hire someone out to figure out why my GPs arn't working like they're supposed to

Thanks for your help
Captain Pooka is offline   Reply With Quote
Old 09-10-2012, 07:48 AM   #6
Fully Optimized
 
jmacavali's Avatar
 
Join Date: Jun 2009
Posts: 4,867
Default Re: Mapping drives through GPO

One thing you can do is go to the top of your AD tree and turn off inheritance. I was having issues with something...can't remember what now...and it was coming from Group Policy, so I just went to the top level and turned off inheritance. Then from the 2nd level I created my own GP and it solved my issues. A bit of a work-around and it will probably screw up the next guy after you...but that's their problem, right...LOL
__________________
****************************************
Don't take life too seriously -- no one gets out alive. Plus, who wants to arrive to the hereafter in pristine condition wearing a suit and tie?
I want to slide in sideways, worn out, used up, hair a mess, clothes tattered, & screaming, "Whooo! What a ride!"
****************************************
jmacavali is offline   Reply With Quote
Old 09-12-2012, 08:57 AM   #7
Daemon Poster
 
Captain Pooka's Avatar
 
Join Date: Oct 2006
Posts: 1,108
Default Re: Mapping drives through GPO

You know, it's actually working great for my test OU and my test account now. I found that I didn't have the VBS placed in an accessible UNC to everyone But... now it is and only my test account works.

Actually I lied. I don't really know what's going on. I have a laptop next to me that I'm testing on.
The test account works on the laptop AND my computer.
My account also works on the laptop, however it does not work on my main computer.
The teacher account I'm using to test doesn't work on the laptop or my computer.



---------- Post added at 07:57 AM ---------- Previous post was at 07:53 AM ----------

I also tried making a GPO that JUST had the VBS in it. That's also not working. I can see that both policies are active on the account by doing a gpresult.
Captain Pooka is offline   Reply With Quote
Old 09-12-2012, 09:23 AM   #8
Daemon Poster
 
Captain Pooka's Avatar
 
Join Date: Oct 2006
Posts: 1,108
Default Re: Mapping drives through GPO

Alright... So my account is working on the laptop, but not my computer.
The teacher account isn't working on either.

I tried simply running the VBS (Don't know why I didn't do that earlier) and here's what I came up with.

When running the VBS, my account maps the drives on my computer. So... for some reason this GPO isn't taking effect on my account.

When running the VBS, my teacher account does not map the drives. I can't see why for the life of me. All the information in my VBS is correct.

When I add my account and my teacher account to the test OU, still doesn't work. However, when I add my teacher account to my testgroup (last group on my VBS) the teacher account then works. So something has to be wrong with the group... but when comparing the two groups there is nothing different. I'm going to recreate the group.

Recreating the group didn't work. Now I see another thing to pile on.
Running the VBS does not work when she's simply in the Fourth grade group. So I added her to the test group, She worked! However, she added the drives from BOTH groups. So... it's like the VBS is working for fourth group, but ONLY when she's in the test group. I'm at a loss.

Recreating the group did not work. However, again, when added to my test group it added the mapped drives from both groups.

It's like a clogged drain. And when you add the users to the test group (IE add draino) it lets everything through at once.
Captain Pooka is offline   Reply With Quote
Old 09-13-2012, 08:25 AM   #9
Fully Optimized
 
jmacavali's Avatar
 
Join Date: Jun 2009
Posts: 4,867
Default Re: Mapping drives through GPO

Do all the groups have security rights and access to the shares on the server that you are trying to map to?
__________________
****************************************
Don't take life too seriously -- no one gets out alive. Plus, who wants to arrive to the hereafter in pristine condition wearing a suit and tie?
I want to slide in sideways, worn out, used up, hair a mess, clothes tattered, & screaming, "Whooo! What a ride!"
****************************************
jmacavali is offline   Reply With Quote
Old 09-23-2012, 12:18 AM   #10
Baseband Member
 
Join Date: Sep 2012
Posts: 32
Default Re: Mapping drives through GPO

I am curious what is going on with your GPO's. You should run an RSOP test against a user and DCdiag to see if you are having any bigger issues that need to get resolved.
__________________

chris321 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 01:31 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0