Requin | 1) Installer ton imprimante sur le serveur d'impression (ton 2000 server typiquement)
2) Mettre un script de connexion (idéalement via une GPO) pour qu'elle soit connectée au login de l'utilisateur
Voici par exemple un tel script (écrit en VBScript), je n'ai pas défini d'imprimante par défaut, mais celà peut se faire à l'aide de l'objet WScript.Network.SetDefaultPrinter (donc wshNetwork.SetDefaultPrinter "\\monserveur\monimprimante" ):
Code :
- Option Explicit
- On Error Resume Next
- Dim wshNetwork, wshShell, wshSysEnv, colDrives, nReturnCode
- Dim i, j
- Dim aryDrives, aryShares, strUser
- Dim colPrinters, aryPrinters
- Dim BS
- BS = Chr(92) ' Set a backslash (\)
- Set wshNetwork = WScript.CreateObject("WScript.Network" )
- Set wshShell = WScript.CreateObject("WScript.Shell" )
- Set wshSysEnv = wshShell.Environment("SYSTEM" )
- strUser = wshShell.ExpandEnvironmentStrings("%USERNAME%" )
- ' Those array are linked, using two 1-dim arrays instead of one 2-dim array
- aryDrives = Array("F:", "M:", "O:", "U:" )
- aryShares = Array("\\monserveur\metro$", _
- "\\monserveur\partage$\" & strUser & "\mes documents", _
- "\\monserveur\partage$\" & strUser & "\outlook", _
- "\\monserveur\partage$" )
- aryPrinters = Array("\\monserveur\infoprint", _
- "\\monserveur\bobcolpt1-p", _
- "\\monserveur\bobcolpt1-l", _
- "\\monserveur\bobcobac-l" )
- If (wshSysEnv("OS" ) = "Windows_NT" ) Then
-
- ' Connect drives
- Set colDrives = wshNetwork.EnumNetworkDrives
- For i = 0 To colDrives.Count - 1 Step 2
- ' Disconnect previous connections
- For j = LBound(aryDrives) To UBound(aryDrives)
- If (colDrives(i) = aryDrives(j)) Then
- wshNetwork.RemoveNetworkDrive aryDrives(j)
- End If
- Next
- Next
- ' Map new drive
- If UBound(aryDrives) = UBound(aryShares) Then
- For i = Lbound(aryDrives) To UBound(aryDrives)
- wshNetwork.MapNetworkDrive aryDrives(i), aryShares(i)
- Next
- Else
- MsgBox "Error into connexion's script, aryShares and arryDrives aren't of the same size !"
- End If
-
- ' Connect printers
- Set colPrinters = wshNetwork.EnumPrinterConnections
- For i = 0 To colPrinters.Count - 1 Step 2
- ' Disconnect already connected printers
- For j = LBound(aryPrinters) To UBound(aryPrinters)
- If (colPrinters(i) = aryPrinters(j)) Then
- wshNetwork.RemovePrinterConnection aryPrinters(j)
- End If
- Next
- Next
- For j = LBound(aryPrinters) To UBound(aryPrinters)
- wshNetwork.AddWindowsPrinterConnection aryPrinters(j)
- Next
- Else
- WScript.Echo "This WSH logon script supports only Windows NT/2000/XP/2003." & vbNewLine &_
- "Exiting..."
- Set wshNetwork = Nothing
- Set wshShell = Nothing
- WScript.Quit(1)
- End If
- Set wshNetwork = Nothing
- Set wshShell = Nothing
- WScript.Quit(nReturnCode)
|
Ces scripts sont assez souples, tu peux aller sur http://msdn.microsoft.com/scripting/ pour aller cehrcher la doc et référence du langage. Il existe aussi sur Technet le "Microsoft Script Center" avec pas mal d'exemples de scripts) Message édité par Requin le 07-05-2004 à 13:05:47
|