Hello! Le problème est résolut
![:bounce: :bounce:]()
et biensur je remerci les personnes qui m'on aider
Le fait que j'ai posté ce dilemme, je me dois donner la solution...
Conclusion: ne pas mettre l'imprimante en partage ou essayer de se connecter par son port car elle est en local donc le poste la reconnais automatiquement par son nom tout simplement
Voici le code avec une amélioration de débogage pour le test biensur:
bDebug = True
Select Case LCase(UserGroup.Name)
Case "population"
If bDebug Then
MsgBox "Case Service"
End If
Dim oNetwork, sNomPoste
' IMPRIMANTE RESEAU
WshNetwork.AddWindowsPrinterConnection "\\SERVEUR\IMP-1-N&B"
WshNetwork.AddWindowsPrinterConnection "\\SERVEUR\IMP-2-N&B"
WshNetwork.SetDefaultPrinter "\\SERVEUR\IMP-3-N&B"
If bDebug Then
MsgBox "Case Population : Imprimante Reseau"
End If
' RECUPERATION NOM DU POSTE
Set oNetwork = CreateObject("WScript.Network" )
sNomPoste = oNetwork.ComputerName
If bDebug Then
MsgBox "Case Service : Nom du poste : " & sNomPoste
End If
' METTRE PAR DEFAUT IMPRIMANTE LOCALE
Select Case sNomPoste
Case "X01"
WshNetwork.SetDefaultPrinter "imp-X01"
Case "X02"
WshNetwork.SetDefaultPrinter "imp-X02"
End Select
Bonne continuation!