Je voudrais afficher la liste des imprimantes de la machines dans une liste déroulante :

mais j'ai une erreur sur mon code en ligne 16 : "strComputer = ".""

voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
28
 
 
<% @LANGUAGE="VBScript" %>
 
<html> 
 <head>
  <script language="VBscript">
   Function liste(form5)
    MsgBox "Elément " & (form5.list.selectedIndex + 1)
   End Function 
  </script> 
 </head> 
 <body> Entrez votre choix : 
  <form name="form5"> 
   <select name="list"> 
   <%
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colInstalledPrinters =  objWMIService.ExecQuery("Select * from Win32_PrinterConfiguration")
   %> 
   <% For Each objPrinter in colInstalledPrinters %>
    <option value="<% = objPrinter.Name %>"><% = objPrinter.Name %></option>
   <% Next %>
   </select>
   <input type="button" name="b" value="Quel est l'imprimante retenu ?" onClick="liste(form5)"> 
  </form>
 </body> 
</html>