OVH Cloud OVH Cloud

[VBSCRIPT] Script pour connecter une imprimante lors de la connexi

14 réponses
Avatar
David
Bonjour le forum,

Pourriez-vous me dire où je pourrais trouver un script en vbscript qui me
permettrait de se connecter à l'imprimante réseau.

Tous les PC du domaine commence par SalleInfoPC ça va de SalleInfoPC04 à
SalleInfoPC18

Je suis sous Windows Server 2003 pour le serveur et sous Windows XP Pro pour
les clients.

Merci d'avance pour votre aide.

David

10 réponses

1 2
Avatar
Michel Claveau
Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau
Avatar
David
Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement désespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau





Avatar
Benoit

Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement désespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau







Avatar
David
Bonjour Benoit,

Tu as dû répondre à mon message, merci, mais ta réponse n'apparaît pas.

David





Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement désespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau









Avatar
Benoit
l'erreur apparaît sur tous les postes ? pas seulement le pc15 ?
as-tu la même erreur quand tu fais un "Net Use" ?


Bonjour Benoit,

Tu as dû répondre à mon message, merci, mais ta réponse n'apparaît pas.

David





Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement désespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau











Avatar
David
L'erreur est sur tous les postes.

Avec les informations que tu as ci-dessous (non du share...) pourrais-tu stp
m'écrire la commande net use ?

Merci d'avance.
David
"Benoit" wrote:

l'erreur apparaît sur tous les postes ? pas seulement le pc15 ?
as-tu la même erreur quand tu fais un "Net Use" ?


Bonjour Benoit,

Tu as dû répondre à mon message, merci, mais ta réponse n'apparaît pas.

David





Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement désespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau













Avatar
kevin
Salut,

tu devrais trouver ton bonheur sur l'excellent site de jcbellamy :
http://jc.bellamy.free.fr/fr/vbsdownload.html


Bonjour Benoit,

Tu as dû répondre à mon message, merci, mais ta réponse n'appara ît pas.

David





Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement d ésespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par d éfaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau











Avatar
Benoit
si tu n'as pas lpt1: déclarée sur le poste :


"net use lpt1: pharmacieRICOHAfi"

c'est tout !


L'erreur est sur tous les postes.

Avec les informations que tu as ci-dessous (non du share...) pourrais-tu stp
m'écrire la commande net use ?

Merci d'avance.
David
"Benoit" wrote:

l'erreur apparaît sur tous les postes ? pas seulement le pc15 ?
as-tu la même erreur quand tu fais un "Net Use" ?


Bonjour Benoit,

Tu as dû répondre à mon message, merci, mais ta réponse n'apparaît pas.

David





Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement désespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau















Avatar
David
Merci pour vos réponses Kévin et Benoit,

Je viens avec du neuf !

J'ai créé un fichier bat où j'ai mis :

net use lpt1: pharmacieRICOHAfi
pause

J'ai mis ce fichier bat dans un des profils itinérant obligatoire.

Et quand je le lance manuellement, il me dit :

"le mot de passe n'est pas valide pour pharmacieRICOHAfi"

Qu'en penses-tu Benoit ?

Merci pour l'aide !

David



"Benoit" wrote:

si tu n'as pas lpt1: déclarée sur le poste :


"net use lpt1: pharmacieRICOHAfi"

c'est tout !


L'erreur est sur tous les postes.

Avec les informations que tu as ci-dessous (non du share...) pourrais-tu stp
m'écrire la commande net use ?

Merci d'avance.
David
"Benoit" wrote:

l'erreur apparaît sur tous les postes ? pas seulement le pc15 ?
as-tu la même erreur quand tu fais un "Net Use" ?


Bonjour Benoit,

Tu as dû répondre à mon message, merci, mais ta réponse n'apparaît pas.

David





Bonjour Michel,

Merci pour ta réponse.

oui c'est uniquement pour se connecter.

j'ai trouvé un script vbs qui me permet de le faire mais il dit à chaque
fois que le nom de mon imprimante réseau est inccorect.

Sais-tu comment je peux connaitre le nom à mettre dans le script ?

J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage), est-ce
ce nom que je dois utiliser ?

Voici mon script :

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SalleInfoPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC03"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC04"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC05"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC06"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC07"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC08"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC09"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC10"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC11"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC12"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC13"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC14"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC15"
sPrintPath = "pharmacieRICOH Aficio AP410N PS"
Case "SalleInfoPC16"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC17"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC18"
sPrintPath = "pharmacieRICOHAfi"
Case "SalleInfoPC19"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

J'espère que tu pourras encore m'aider car je suis réellement désespéré.

Merci encore
David


Bonjour !

Juste pour se connecter ? Simple : NET USE
Avec NET USE /? tu auras plus de renseignements.

Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
les reconnexions sont automatiques.

--
@-salutations

Michel Claveau

















Avatar
Gilles LAURENT
"David" a écrit dans le message de
news:
| Bonjour Michel,
|
| Merci pour ta réponse.
|
| oui c'est uniquement pour se connecter.
|
| j'ai trouvé un script vbs qui me permet de le faire mais il dit à
| chaque fois que le nom de mon imprimante réseau est inccorect.
|
| Sais-tu comment je peux connaitre le nom à mettre dans le script ?
|
| J'ai fais un net share et je vois RICOHAfi (c'est le nom du partage),
| est-ce ce nom que je dois utiliser ?
|
| Voici mon script :
|
| Option Explicit
| Dim oNetwork, sPrintPath
| Set oNetwork = CreateObject("WScript.Network")
| Select Case oNetwork.ComputerName
| Case "SalleInfoPC02"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC03"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC04"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC05"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC06"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC07"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC08"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC09"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC10"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC11"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC12"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC13"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC14"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC15"
| sPrintPath = "pharmacieRICOH Aficio AP410N PS"
| Case "SalleInfoPC16"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC17"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC18"
| sPrintPath = "pharmacieRICOHAfi"
| Case "SalleInfoPC19"
| sPrintPath = "pharmacieRICOHAfi"
| End Select
| oNetwork.AddWindowsPrinterConnection sPrintPath
| oNetwork.SetDefaultPrinter sPrintPath
|
| J'espère que tu pourras encore m'aider car je suis réellement
| désespéré.
|
| Merci encore
| David
|
|
|| Bonjour !
||
|| Juste pour se connecter ? Simple : NET USE
|| Avec NET USE /? tu auras plus de renseignements.
||
|| Mais, AMHA, le besoin doit être plus large, car, sous XP, par défaut,
|| les reconnexions sont automatiques.
||
|| --
|| @-salutations
||
|| Michel Claveau

Bonjour,

Le message est du au fait que la clause "SELECT CASE" n'est jamais
vérifée donc la variable sPrintPath n'est jamais assignée. Pour corriger
le problème, il suffit de spécifier le nom de poste en MAJUSCULE.

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
Select Case oNetwork.ComputerName
Case "SALLEINFOPC02"
sPrintPath = "pharmacieRICOHAfi"
Case "SALLEINFOPC03"
sPrintPath = "pharmacieRICOHAfi"
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath

--
Gilles LAURENT
Me contacter : http://cerbermail.com/?zoTY7ZkLcD
1 2