Affichage des icônes lecteurs réseau sur le bureau

Plus d'informations
il y a 11 ans 7 mois - il y a 11 ans 7 mois #47 par Admin KoXo
Réponse de Admin KoXo sur le sujet Affichage des icônes lecteurs réseau sur le bureau
Voici le script d'un groupe primaire "Eleves" avec l'ajout des icônes sur le bureau :
Code:
'-------------------------------------------------------------------------------------------------------------------------- '(c) 2006-2011 KoXo Dev. Script VBS Eleves '-------------------------------------------------------------------------------------------------------------------------- '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 'Folders redirection (remove next line if managed with GPO) Redirections UserObj.HomeDirDrive End If 'Map Group Drive ConnectDrive "Q:","\\%SECONDARY_GROUP_SERVER%\%SECONDARY_GROUP%$","Ma classe [%SECONDARY_GROUP%]" Shortcut GetDesktop & "\Espace personnel.lnk","Espace personnel","CTRL+ALT+SHIFT+H","P:" Shortcut GetDesktop & "\Espace de groupe.lnk","Espace de groupe","CTRL+ALT+SHIFT+G","Q:" 'Remove next quote to manage printers with a simple text file in netlogon 'Execute GetLogonServer+"\NETLOGON\Printers.vbs" 'Remove next quote to display user and computer informations on the wallpaper Execute GetLogonServer+"\NETLOGON\Wallpaper.vbs /wallpaper=\\%SERVER[1]%\NETLOGON\Wallpaper.bmp" 'End WScript.Quit '-------------------------------------------------------------------------------------------------------------------------- '/////////// '// Execute function execute(CommandLine) On Error Resume Next Dim oShell Set oShell=CreateObject("WScript.Shell") err.Number=0 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 '//////////////// '// Redirections function Redirections(Drive) On Error Resume Next Dim oShell Dim Reg,Personnal,Favorites,Templates,History,AppData,Cookies,ExcludeProfileDirs Set oShell=CreateObject("WScript.Shell") Personnal="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal" Reg=oShell.RegWrite(Personnal,Drive+"\Mes documents","REG_SZ") Favorites="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites" Reg=oShell.RegWrite(Favorites,Drive+"\CONFIG\Favoris","REG_SZ") Templates="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Templates" Reg=oShell.RegWrite(Templates,Drive+"\CONFIG\Modeles","REG_SZ") History="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\History" Reg=oShell.RegWrite(History,Drive+"\CONFIG\Historique","REG_SZ") 'AppData="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\AppData" 'Reg=oShell.RegWrite(AppData,Drive+"\CONFIG\Application Data","REG_SZ") 'Cookies="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cookies" 'Reg=oShell.RegWrite(Cookies,Drive+"\CONFIG\Cookies","REG_SZ") ExcludeProfileDirs="HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\ExcludeProfileDirs" Reg=oShell.RegWrite(ExcludeProfileDirs,"Mes Documents;Favoris;Bureau;Menu démarrer;Application Data;Cookies;Modèles","REG_SZ") 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.number=0 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 '//////////////////////////////////////////////////////////////// '// Get "Desktop" Function GetDesktop() Dim objShell Set objShell=CreateObject("WScript.Shell") GetDesktop=objShell.SpecialFolders("Desktop") End Function '//////////////////////////////////////////////////////////////// '// Make shortcut Function Shortcut(FilePath,Description,HotKey,TargetPath) Dim objLink, objShell Set objShell=CreateObject("WScript.Shell") Set objLink=objShell.CreateShortcut(FilePath) objLink.Description=Description objLink.HotKey=Hotkey objLink.TargetPath=TargetPath objLink.WindowStyle=3 objLink.Save End Function '////////////////////////////////////////////////////////////////

Voici le résultat obtenu :



(L'image associée a été définie par un pramètre de registre).

Cdt.

Le support
Pièces jointes :
Dernière édition: il y a 11 ans 7 mois par Admin KoXo.

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

  • Frank Admin
  • Auteur du sujet
  • Hors Ligne
  • Membre premium
  • Membre premium
Plus d'informations
il y a 11 ans 7 mois #48 par Frank Admin
Réponse de Frank Admin sur le sujet Affichage des icônes lecteurs réseau sur le bureau
Bonjour,

Un grand merci pour votre script. Les lecteurs réseau s'affichent bien sur le bureau utilisateur mais j'ai une petite fenêtre qui s'affiche au démarrage de la session maintenant. Il suffit de la fermer et elle ne revient plus durant toute la session. Je vous ai fait une capture d'écran.



J'ai paramétré par GPO l'exécution de scripts en caché mais ça ne change rien.

Cdt.

Frank.
Pièces jointes :

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

Plus d'informations
il y a 11 ans 7 mois - il y a 11 ans 7 mois #49 par Admin KoXo
Réponse de Admin KoXo sur le sujet Affichage des icônes lecteurs réseau sur le bureau
Bonjour,

En effet, il restait une ligne "de trop" dans le script : wscript.echo getdesktop

Cette ligne permettait de vérifier le chemin du bureau lors des tests.

Il suffit donc de supprimer cette ligne et de repropager votre script.

PS : Le script ci-dessus est corrigé.

Cdt.

Le support
Dernière édition: il y a 11 ans 7 mois par Admin KoXo.
Les utilisateur(s) suivant ont remercié: Bruno Alexandre

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

  • Frank Admin
  • Auteur du sujet
  • Hors Ligne
  • Membre premium
  • Membre premium
Plus d'informations
il y a 11 ans 7 mois #53 par Frank Admin
Réponse de Frank Admin sur le sujet Affichage des icônes lecteurs réseau sur le bureau
Bonjour,

Ca fonctionne parfaitement. J'ai juste modifié votre script ligne 21 :

Execute GetLogonServer+"\NETLOGON\Wallpaper.vbs /wallpaper=\\%SERVER[1]%\NETLOGON\Wallpaper.bmp

remplacé par

Execute GetLogonServer+"\NETLOGON\Wallpaper.vbs /BackGroundColor=#000000"

Voilà, j'ai commencé à intégrer mes postes hier. Tout fonctionne correctement.

Merci pour votre aide.

Cdt.

Frank.

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

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