Ajouter un lecteur réseau dans le script eleve4bis

  • ERIC BERRIET
  • Auteur du sujet
  • Hors Ligne
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 7 ans 10 mois #1536 par ERIC BERRIET
Ajouter un lecteur réseau dans le script eleve4bis a été créé par ERIC BERRIET
Bonjour,

J'utilise le script eleve4bis.vbs
Je souhaite faire en sorte que l'élève retrouve son lecteur réseau nommé HISTOIRE dans l'explorateur (à la manièere de l'espace partagé.

J'ai créée l'espace partagé à l'aide de Koxo que j'ai attribué aux utilisateurs et donné tous les droits
J'ai modifié le script (voir ci-script plus bas).
Malheureusement à l'ouverture de session le lecteur partagé n'apparaît pas dans l'explorateur....
Comment faire ?
Merci

La ligne concernée est:
<code> ConnectDrive "V:","\\TEST-KOXO\Eleves$\HISTOIRE","HISTOIRE"

'
'(c) 2006-2015 KoXo Dev. Script VBS "Elèves 4bis"
'
'Unmap existing drives
UnconnDrives
Set UserObj=FindUser
If Not IsEmpty(UserObj) Then
'Map Home Drive
ConnectDrive UserObj.HomeDirDrive,UserObj.HomeDirectory,"Espace personnel de "+UserObj.fullName
End If
'Map Group Drive
ConnectDrive "%GROUP_DRIVE%","\\%SECONDARY_GROUP_SERVER%\%SECONDARY_GROUP%$","Ma classe [%SECONDARY_GROUP%]"
ConnectDrive "V:","\\TEST-KOXO\Eleves$\HISTOIRE","HISTOIRE"
'Remove next quote to display user and computer informations on the wallpaper
Execute GetLogonServer+"\NETLOGON\Wallpaper.vbs /BackGroundColor=#A56E3A"
'End
WScript.Quit
'
'///////////
'// Execute
function execute(CommandLine)
On Error Resume Next
Dim oShell
Set oShell=CreateObject("WScript.Shell")
Err.Clear
oShell.Run CommandLine,1,True
If Err.Number<>0 Then
oShell.Popup "Execution : " & CommandLine & VbCrLf & "Description=" & Err.Description & VbCrLf & "Code=" & Err.Number,5,"Erreur",64
End If
end function
'////////////////////////////////
'// Unconnect all network drives
function UnconnDrives()
On Error Resume Next
Dim objNetwork
Dim i,colDrives
Set objNetwork=WScript.CreateObject("WScript.Network")
'Unmap existing drives
Set colDrives=objNetwork.EnumNetworkDrives
If colDrives.Count<>0 Then
For i=0 To colDrives.Count-1 Step 2
objNetwork.RemoveNetworkDrive colDrives(i),"True","True"
Next
End If
End function
'/////////////////////
'// Find a user in AD
function FindUser()
On Error Resume Next
Dim objNetwork,oScriptShell
Dim strUserName,strUserDomain,sUserObj
Dim i,UserObj
Set objNetwork=WScript.CreateObject("WScript.Network")
Set oScriptShell=CreateObject("WScript.Shell")
strUserName=objNetwork.UserName
strUserDomain=objNetwork.UserDomain
sUserObj="WinNT://" & strUserDomain & "/" & strUserName
i=0
Do
i=i+1
Set UserObj=GetObject(sUserObj)
If UserObj Is Nothing Then WScript.Sleep 1000 End If
Loop While (i<20) And IsEmpty(UserObj)
If UserObj Is Nothing Then
oScriptShell.Popup "Impossible de trouver : " & sUserObj,5,"Erreur GetObject",64
End If
Set FindUser=UserObj
End function
'///////////////////
'// Connect a drive
function ConnectDrive(Drive,Path,Description)
On Error Resume Next
Dim objNetwork,oScriptShell
Set objNetwork=WScript.CreateObject("WScript.Network")
Set oScriptShell=CreateObject("WScript.Shell")
Set oShell=CreateObject("Shell.Application")
Err.Clear
objNetwork.MapNetworkDrive Drive,Path
If Err.Number<>0 Then
oScriptShell.Popup "Connexion lecteur " & Drive & " (" & Path & ")" & VbCrLf & "Description=" & Err.Description & VbCrLf & "Code=" & Err.Number,5,"Erreur",64
Else
oShell.NameSpace(Drive).Self.Name=Description
End If
end function
'//////////////////////
'// Get the LogonServer
function GetLogonServer()
Dim objShell
Set objShell=Wscript.CreateObject("Wscript.Shell")
GetLogonServer=objShell.ExpandEnvironmentStrings("%LOGONSERVER%")
End Function </code>

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.292 secondes