Afficher un raccourci sur le bureau via GPO

  • Mohamed PRJV
  • Auteur du sujet
  • Hors Ligne
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 10 ans 6 mois #328 par Mohamed PRJV
Afficher un raccourci sur le bureau via GPO a été créé par Mohamed PRJV
Bonsoir,

Je souhaite afficher un raccourci sur le bureau d'un programme (ex. client PRONOTE) qui est sur un espace partagé via un script VBS lié à une GPO.

Mais en lisant un autre sujet du forum, je constate que le script login de koxo est lancé après la GPO.

C'est tout à fait normal que ça ne marche pas car la GPo est exécutée avant le script de login, il faut appeler ce script à partir du script de login.

Ou refaire ce script pour être lancé d'une GPO....plus compliqué dans ce cas ....mais pas infaisable

Le support

.

J'ai trouvé un script VBS (voir ci-dessous) qui peut répondre à la création d'un raccourci via une GPO qu'il faut adapter aux variables de koxo, je pense?

Set oShell = WScript.CreateObject("WScript.Shell")
set oFileSystem = WScript.CreateObject("Scripting.FileSystemObject")
sDesktopFolder = oShell.SpecialFolders("Desktop")
if oFileSystem.FileExists(sDesktopFolder & "\Mon Raccourci.lnk") then
oFileSystem.DeleteFile(sDesktopFolder & "\Mon Raccourci.lnk")
end if
Set oShortcut = oShell.CreateShortcut(sDesktopFolder & "\Mon Raccourci.lnk")
oShortcut.TargetPath = 'Mettre ici le chemin vers la cible du raccourci
'mettre l'icône souhaitée en modifiant le 60 (ou en utilisant un autre
fichier)
oShortcut.IconLocation = "%SystemRoot%\System32\SHELL32.dll,60"
oShortcut.Save


Si quelqu'un a une idée pour la suite du script afin de le lancer avant avec script login.

Merci d'avance.

Mohamed

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

Plus d'informations
il y a 10 ans 6 mois #329 par Admin KoXo
Réponse de Admin KoXo sur le sujet Afficher un raccourci sur le bureau via GPO
Bonjour,

Le plus simple est peut être de rajouter la création dynamique du raccourcis à la fin du script de login des professeurs.

Pour ce faire, vous pouvez rajouter en fin du script de login une fonction qui détermine l'emplacement du bureau et une autre qui crée le raccourci :
Code:
'//////////////////////////////// '// 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 '//////////////////////////////// '// Get "Desktop" Function GetDesktop() Dim objShell Set objShell=CreateObject("WScript.Shell") GetDesktop=objShell.SpecialFolders("Desktop") End Function

Dans le script principal vers la fin par exemple, il faudra faire quelque chose du genre :
Code:
MyDesktop=GetDesktop Pronote="\\SRV-PRONOTE\Pronote\Client Pronote 2013.exe" Shortcut MyDesktop & "\Client Pronote.lnk","Client Pronote","CTRL+ALT+SHIFT+D",Pronote

Cdt.

Le support

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

Plus d'informations
il y a 10 ans 6 mois #330 par Admin KoXo
Réponse de Admin KoXo sur le sujet Afficher un raccourci sur le bureau via GPO
Voici un exemple complet pour tester le fonctionnement sur une installation en local du client Pronote 2013 :
Code:
MyDesktop=GetDesktop ShortcutLink="C:\Program Files (x86)\Index Education\Pronote 2013\Réseau\Client Pronote 2013.exe" ShortcutFile=MyDesktop & "\Client Pronote.lnk" ShortcutInfo="Client Pronote 2013" Shortcut ShortcutFile,ShortcutInfo,"",ShortcutLink '//////////////////////////////// '// 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 '//////////////////////////////// '// Get "Desktop" Function GetDesktop() Dim objShell Set objShell=CreateObject("WScript.Shell") GetDesktop=objShell.SpecialFolders("Desktop") End Function

Cdt.

Le support

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

  • Mohamed PRJV
  • Auteur du sujet
  • Hors Ligne
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 10 ans 6 mois #335 par Mohamed PRJV
Réponse de Mohamed PRJV sur le sujet Afficher un raccourci sur le bureau via GPO
Bonsoir,

Super pour la réponse aussi rapide c'est vraiment un super support technique.

J'ai placé le script "raccourci" à la suite du script login et voilà.

Maintenant le je vais voir si je peux supprimer les anciens raccourcis du bureau via un script/GPO?

Mohamed

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

Plus d'informations
il y a 10 ans 6 mois - il y a 10 ans 6 mois #355 par Admin KoXo
Réponse de Admin KoXo sur le sujet Afficher un raccourci sur le bureau via GPO
Voici un exemple de modèle de script pour un groupe primaire (à propager) :

Ne pas oublier de modifier la ligne 15 : Pronote="\\SRV-PRONOTE\Pronote\Client Pronote 2013.exe"
Code:
'-------------------------------------------------------------------------------------------------------------------------- '(c) 2006-2012 KoXo Dev. Script VBS Professeurs '-------------------------------------------------------------------------------------------------------------------------- '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 'Shortcut MyDesktop=GetDesktop Pronote="\\SRV-PRONOTE\Pronote\Client Pronote 2013.exe" Shortcut MyDesktop & "\Client Pronote.lnk","Client Pronote","CTRL+ALT+SHIFT+D",Pronote 'Map Group Drive ConnectDrive "Q:","\\%SECONDARY_GROUP_SERVER%\%SECONDARY_GROUP%$","Ma discipline [%SECONDARY_GROUP%]" ConnectDrive "R:","\\%SERVER[1]%\Eleves$","Espaces personnels des élèves" ConnectDrive "S:","\\%SERVER[1]%\Classes$","Espaces communs des classes" '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 /BackGroundColor=#808080" '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 '//////////////////////////////// '// 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 '//////////////////////////////// '// Get "Desktop" Function GetDesktop() Dim objShell Set objShell=CreateObject("WScript.Shell") GetDesktop=objShell.SpecialFolders("Desktop") End Function

Cdt.

Le support
Dernière édition: il y a 10 ans 6 mois par Admin KoXo.

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

  • Mohamed PRJV
  • Auteur du sujet
  • Hors Ligne
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 10 ans 6 mois #391 par Mohamed PRJV
Réponse de Mohamed PRJV sur le sujet Afficher un raccourci sur le bureau via GPO
Bonsoir,

J'ai mis en place le script et remplacé la ligne 15 dans le groupe primaire mais j'ai pas le raccourci pronote sur le bureau.

Donc je suis revenu à la première version du script dans les groupes secondaires et là le raccourci ne fonctionne pas un fois sur deux, avec l'affiche de message "impossible de lancer l'application à distance"??

cdt

mohamed

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

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