Script vbs para montar unidades de grupo

Imagen de jopeme
0 puntos

Estoy intentando desde Zentyal 3.2 basada en Ubuntu crear una GPO para que cuando un usuario se logue en samba 4 le monte la unidad Y como una unidad de su grupo. Este script me da el error siguiente si intento ejecutarlo desde un cliente win 7 que previamente se ha logado con un usuario del servidor. Si ejecuto \\miservidor\netlogon\logon.vbs me muestra el error:
En esta línea:
strGroupADSPath = "WinNT://mydomain/" & strGrp & ",group"
y el error
Error says "Is not found path to access to network", code "80070035"

Option Explicit
'dimension all our variables
dim objNetwork
dim strDriveLetter, strRemotePath, strUser, strGrp
dim strGroupADSPath, strUserADSPath, grp

'This script will use the MapNetworkDrive method
'for each network drive mapped.

'We'll be using the Wscript.Network Object to enumerate the user as well as to map drives.
'We only need to instantiate it once at the beginning.
Set objNetwork = Wscript.CreateObject("Wscript.Network")

'First let's get the user name since we'll use it for mapping the home directory
'as well as checking group memberships.
strUser = objNetwork.UserName

'In just about every network at least two drives are mapped:
'One for the user's home directory, and one for an organizational public share.
'We'll map those first since they don't depend on group memberships.

'next we'll enumerate groups and map drives for specific departmental memberships
'The code to check for memberships and map the drives is in a subroutine called IsMember.
'All we have to doet nis copy the same block over again for each group membership we want to check.
'The block only needs to set the string values for the group name, the desired drive letter, and the share path.
'Then it calls the IsMember subroutine down below.

'Mapeia letra do drive de strDriveLetter para o compartilhamento informado
'em strRemotePath se o usuario for membro do grupo strGrp

'Y: grupob12manana
strDriveLetter = "y:"
strRemotePath = "\\server\grupob12manana"

'Y: grupob12tarde
strDriveLetter = "y:"
strRemotePath = "\\server\grupob12tarde"

'Repeat for as many private groups and their respective enumerated shares as you wish.

'We're done with the login script.
'Let's tidy up variables first to make sure we're not leaving anything behind.
objNetwork = ""
strDriveLetter = ""
strRemotePath = ""
strUser = ""
strGrp = ""
strGroupADSPath = ""
strUserADSPath = ""
grp = ""
'That's all. Close the script processor.

sub IsMember
'wscript.echo strGrp
'set the directory service path to enumerate the group
strGroupADSPath = "WinNT://mydomain/" & strGrp & ",group"
'poll the PDC for the group
set grp = GetObject(strGroupADSPath)
'set the user directory service path to enumerate the user
strUserADSPath = "WinNT://mydomain/" & strUser
'Check membership in the group.
If (grp.IsMember(strUserADSPath)) Then
'map the drive
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
End If
'clean up variables for next group check.
strGrp = ""
strDriveLetter = ""
strRemotePath = ""
'Rinse, lather and repeat this code as many times as needed.
End sub