Principales respuestas
Logon Script - Mapeo de discos segun grupo de AD

Pregunta
-
Respuestas
-
Hola Jorge, una opción es lo que comenta jerry-g
Otra opción es un script que haga el trabajo de ver los grupos.
Pego un ejemplo abajo, que supongo que podrás adaptar fácilmente
No es mío ;-) pero son esas cosas que uno guarda por las dudas :-)
------------
Option Explicit
On Error Resume NextDim oFSO, oWshNetwork, oGroupDict
'Map drives based on Group memberships
If IsMember("Group1") Then
MapDrive "S:", "\\Server\Share"
End IfIf IsMember("Group2") Then
MapDrive "T:", "\\Server\Share1"
MapDrive "P:", "\\Server2\Share2"
End If'Supporting function to enumerate group memberships
Function IsMember(sGroup)
Dim sAdsPath, oUser, oGroupIf IsEmpty(oGroupDict) Then
Set oGroupDict = CreateObject("Scripting.Dictionary")
oGroupDict.CompareMode = vbTextComparesAdsPath = oNet.UserDomain & "/" & oNet.UserName
Set oUser = GetObject("WinNT://" & sAdsPath & ",user")For Each oGroup In oUser.Groups
oGroupDict.Add oGroup.Name, "-"
NextSet oUser = Nothing
End IfIsMember = CBool(oGroupDict.Exists(sGroup))
End Function
'Supporting function to Map drives
'If drive letter is in use, attempts to remove connection.
'Returns True if drive mapped, False otherwise.
Function MapDrive(sDrive, sShare)
Dim oDrive
On Error Resume Next
Err.Clear
If oFSO.DriveExists(sDrive) Then
Set oDrive = oFSO.GetDrive(sDrive)
If Err.Number <> 0 Then
Err.Clear
MapDrive = False
Exit Function
End If
If CBool(oDrive.DriveType = 3) Then
oNet.RemoveNetworkDrive sDrive, True, True
Else
MapDrive = False
Exit Function
End If
Set oDrive = Nothing
End If
oNet.MapNetworkDrive sDrive, sShare
'Error trapping
If Err.Number = 0 Then
MapDrive = True
Else
Err.Clear
MapDrive = False
End If
On Error GoTo 0
End Function
-----------------------------------------
Guillermo Delprato - MVP-MCT-MCITP-MCTS-MCSE MCITP: Server Administration MCTS:Active Directory/Network Infrastructure Buenos Aires, Argentina- Marcado como respuesta Cavallin Jorge martes, 17 de noviembre de 2009 11:49
Todas las respuestas
-
Lo que tienes que hacer es agrupar los usuarios ademas de los grupos de seguridad en OUS y dentro de cada OU generas la politica de mapeo creando un archivo bat con el comando net use para el mapeo de las unidades o impresoras que necesites
- Propuesto como respuesta Kilian Arjona sábado, 14 de noviembre de 2009 21:44
-
Hola Jorge, una opción es lo que comenta jerry-g
Otra opción es un script que haga el trabajo de ver los grupos.
Pego un ejemplo abajo, que supongo que podrás adaptar fácilmente
No es mío ;-) pero son esas cosas que uno guarda por las dudas :-)
------------
Option Explicit
On Error Resume NextDim oFSO, oWshNetwork, oGroupDict
'Map drives based on Group memberships
If IsMember("Group1") Then
MapDrive "S:", "\\Server\Share"
End IfIf IsMember("Group2") Then
MapDrive "T:", "\\Server\Share1"
MapDrive "P:", "\\Server2\Share2"
End If'Supporting function to enumerate group memberships
Function IsMember(sGroup)
Dim sAdsPath, oUser, oGroupIf IsEmpty(oGroupDict) Then
Set oGroupDict = CreateObject("Scripting.Dictionary")
oGroupDict.CompareMode = vbTextComparesAdsPath = oNet.UserDomain & "/" & oNet.UserName
Set oUser = GetObject("WinNT://" & sAdsPath & ",user")For Each oGroup In oUser.Groups
oGroupDict.Add oGroup.Name, "-"
NextSet oUser = Nothing
End IfIsMember = CBool(oGroupDict.Exists(sGroup))
End Function
'Supporting function to Map drives
'If drive letter is in use, attempts to remove connection.
'Returns True if drive mapped, False otherwise.
Function MapDrive(sDrive, sShare)
Dim oDrive
On Error Resume Next
Err.Clear
If oFSO.DriveExists(sDrive) Then
Set oDrive = oFSO.GetDrive(sDrive)
If Err.Number <> 0 Then
Err.Clear
MapDrive = False
Exit Function
End If
If CBool(oDrive.DriveType = 3) Then
oNet.RemoveNetworkDrive sDrive, True, True
Else
MapDrive = False
Exit Function
End If
Set oDrive = Nothing
End If
oNet.MapNetworkDrive sDrive, sShare
'Error trapping
If Err.Number = 0 Then
MapDrive = True
Else
Err.Clear
MapDrive = False
End If
On Error GoTo 0
End Function
-----------------------------------------
Guillermo Delprato - MVP-MCT-MCITP-MCTS-MCSE MCITP: Server Administration MCTS:Active Directory/Network Infrastructure Buenos Aires, Argentina- Marcado como respuesta Cavallin Jorge martes, 17 de noviembre de 2009 11:49
-
Hola gente muy amables , por todo.
Fijensen esto :
dsquery user -samid %username% | dsget user -memberof -expand | dsget group -samid >group.txt
de esta manera , listo los grupos a que pertenesco y lo grabo en un txt.
Bien el tema seria leer el contenido del txt y hacer un if , si es igual a loque busco , ñacate , le mapeo el disco o carpeta que corresponda .... Que les parece?... bien no se como leer el txt y que haga comparaciones menos. Saludos -
Me parece mucho más complicado que el script de vbs que te puse antes, pero sobre gustos... :-)
Guillermo Delprato - MVP-MCT-MCITP-MCTS-MCSE MCITP: Server Administration MCTS:Active Directory/Network Infrastructure Buenos Aires, Argentina -