![]() | Register | FAQ | Members | Social Groups | User Map | Calendar | Search | Today's Posts | Mark Forums Read |
| Scripts If you need or have any scripts then get 'em here. |
| ||
| | | LinkBack | Thread Tools | Search Thread |
| Sponsored Links |
| | #1 |
![]() Join Date: May 2009 Location: UK
Posts: 151
Thanks: 27
Thanked 14 Times in 13 Posts
Rep Power: 4 | Code: net use * /delete net use f: \\server\AdminShare Code: net use * /delete net use g: \\server\OtherShare Is there any way to do this? I thought of this pseudocode: Code: net use * /delete
if group = "Administrators" then
net use f: \\server\AdminShare
goto end
if group = "Power Users" then
net use f: \\server\OtherShare
goto end
Thanks in advance. |
| |
| | #2 |
![]() Join Date: Dec 2005 Location: Birmingham
Posts: 4,820
Thanks: 85
Thanked 681 Times in 519 Posts
Rep Power: 137 | There isn't really any simple solution to this. You could map both drives in a single logon script, but then configure permissions so users can access either one or the other (depending who they logon as). |
| |
| | #3 |
![]() Join Date: May 2009 Location: UK
Posts: 151
Thanks: 27
Thanked 14 Times in 13 Posts
Rep Power: 4 | Thanks Michael. I've configured the share and folder permissions appropriately. I'd prefer to hide folders to which users don't have access, hence the idea of deleting all the mapped folders and recreating the mapping at each login. Since posting earlier today, I've investigated further: Code: net localgroup > group.txt Code: net localgroup <groupname> | find "Name" (I need to check the syntax of passing %username% to this line) I *think* I'm on the right track but realise that it's not so easy as it would be if it were a domain. |
| |
| | #5 |
![]() Join Date: May 2009 Location: UK
Posts: 151
Thanks: 27
Thanked 14 Times in 13 Posts
Rep Power: 4 | Thanks again. I'd had a look at that site and suspect that the code relates to a domain rather than a workgroup. When it mentions "groups", I think it refers to AD groups. I'll be able to test this out early next week on the workgroup and I'll also have access to a Windows 2003 and single XP Pro client to check out whether it's only for a domain. |
| |
| | #6 |
![]() Join Date: Aug 2005 Location: London
Posts: 2,259
Thanks: 46
Thanked 315 Times in 278 Posts
Blog Entries: 1 Rep Power: 72 | You should be able to use the code below. Basically, it gets the name of the user and computer, clears all existing drive mappings and then connects to the user object to get its properties. It then loops through all the groups, converts the name to lower case (may not be necessary but does no harm ...) and then calls a routine to check what drives should be mapped for the groups. You'll need to change the "mapdrive" subroutine to deal with the groups you have and the shares you want to use. the only thing this won't cope with is nested groups but I'm guessing that in a workgroup you're not likely to have such a problem. Code: Set oNetwork = CreateObject("Wscript.Network")
sUser=oNetwork.UserName
sComputer=oNetwork.computername
ClearMappedDrives
set oUser=getobject("WinNT://" & sComputer & "/" & sUser)
for each oGroup in oUser.groups
sGroup=lcase(oGroup.name)
MapDrive sGroup
next
sub clearmappeddrives
set oDrives=oNetwork.enumnetworkdrives
For i = 0 to oDrives.Count - 1 Step 2
onetwork.removenetworkdrive oDrives.Item(i)
Next
end sub
sub MapDrive(sGroup)
select case sGroup
case "administrators"
oNetwork.mapnetworkdrive "z:","\\computer1\share1"
oNetwork.mapnetworkdrive "q:","\\computer2\sharedocs"
case "finance"
oNetwork.mapnetworkdrive "q:","\\computer2\sharedocs"
case "registry"
oNetwork.mapnetworkdrive "q:","\\computer2\sharedocs"
end select
end sub
|
| |
| Thanks to srochford from: | Ignatius (21-06-2009)
|
| | #7 |
![]() Join Date: May 2009 Location: UK
Posts: 151
Thanks: 27
Thanked 14 Times in 13 Posts
Rep Power: 4 | Thanks Steve - that looks good. I'll be able to test it within the next few days. |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [ASP.net] Show webpage based on group membership | MK-2 | Web Development | 1 | 09-04-2009 11:53 AM |
| Group Policy loopback affecting folder redirection | rocknrollstar | Windows | 2 | 25-11-2008 08:05 AM |
| Changing AD home folder location to a group? | mrbios | Windows | 2 | 01-08-2007 10:59 AM |
| Group Policy folder lockdown | speckytecky | General Chat | 2 | 12-07-2007 08:29 AM |
| Group Membership Woes (Need Help) | ICTNUT | Windows | 11 | 02-12-2005 04:19 PM |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search Thread |
| |









