> Tech > listings

listings

Tech - Par Renaud ROSSET - Publié le 24 juin 2010
email

Listing 1 : Script pour se connecter à  une imprimante

A

Option Explicit
Dim oNetwork, sPrintPath

B

Set oNetwork = CreateObject("WScript.Network")

C
listings

SIZE= »1″>

sPrintPath = « \\servername\printername »

D

Network.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

Listing 2 : Script pour créer une connexion d’imprimante propre à  un ordinateur


Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject(« WScript.Network »)
Select Case oNetwork.ComputerName    A
  Case « Gamma »
   s PrintPath = « \\server\printer1 »
  Case « Geektoy »
    sPrintPath = « \\server\printer2 »
  Case Else
   sPrintPath = « \\server\printer3 »
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

Listing 3 : Script pour créer une connexion d’imprimante
propre à  un endroit


Option Explicit
Dim oNetwork, sPrintPath, sLocate
Set oNetwork = CreateObject(« WScript.Network »)

sLocate =_   A
    InputBox(« Where are
you? Type ‘Lab’, ‘Library’, or ‘Reception’. »)
Select Case sLocate
  Case « Lab »
    sPrintPath = « \\server\printerA »
  Case « Library »
    sPrintPath = « \\server\printerB »
  Case « Reception »
    sPrintPath = « \\server\printerC »
  Case Else
    MsgBox(« That is not a valid choice. The script will
exit. ») :WScript.
End Select

oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

Téléchargez cette ressource

État des lieux de la réponse à incident de cybersécurité

État des lieux de la réponse à incident de cybersécurité

Les experts de Palo Alto Networks, Unit 42 et Forrester Research livrent dans ce webinaire exclusif leurs éclairages et stratégies en matière de réponses aux incidents. Bénéficiez d'un panorama complet du paysage actuel de la réponse aux incidents et de sa relation avec la continuité de l'activité, des défis auxquels font face les entreprises et des tendances majeures qui modèlent ce domaine. Un état des lieux précieux pour les décideurs et professionnels IT.

Tech - Par Renaud ROSSET - Publié le 24 juin 2010

A lire aussi sur le site

Revue Smart DSI

La Revue du Décideur IT