Erreur fin d'instruction attendue 800A0401
Bonjour, je souhaite pour quelques profils itinérants modifier le comportement des imprimantes itinérantes, un agent qui se connecte sur tel ordinateur a tel imprimante, je me suis inspiré de ce script vbs fourni sur le site de microsoft, ils indiquent de modifier les lignes en if des infos qu'il y'a entre guillemets :
https://learn.microsoft.com/fr-fr/tr...aming-profiles
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Option Explicit
DIM RegEntry, ComputerName
RegEntry="HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName" ComputerName = ReadRegValue(RegEntry)
if InStr(1,ucase(ComputerName),"LAB1-",vbTextCompare) > 0 then call SetPrinter("\\LAB1\LaserJet")
if InStr(1,ucase(ComputerName),"LAB2-",vbTextCompare) > 0 then call SetPrinter("\\LAB2\LaserJet")
if InStr(1,ucase(ComputerName),"OFFICE-",vbTextCompare) > 0 then call SetPrinter("\\OFFICE\LaserJet")
'so on and so forth.
wscript.quit
'*** This subroutine installs and sets the default printer
Sub SetPrinter(ByVal PrinterPath)
DIM WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection(PrinterPath)
WshNetwork.SetDefaultPrinter Printerpath
end sub
'**** This function returns the data in the registry value
Function ReadRegValue(ByVal RegValue)
DIM WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
ReadRegValue=""
On Error Resume Next
ReadRegValue= WSHShell.RegRead(RegValue)
End Function |
Lors de l'ouverture de la session utilisateur un message d'erreur apparait :
Script : ...... .vbs
Ligne : 4
Caract : 89
Erreur : Fin d'instruction attendue
Code : 800A0401
Source : Erreur de compilation Microsoft VBScript
Info en plus, les utilisateurs ne sont pas administrateurs de l'ordinateur et l'ordinateur est joint à un domaine.