| auteur : SilkyRoad |
Lister les imprimantes installées et préciser laquelle est active :
VBS |
Dim objWMIService, colInstalledPrinters, objPrinter
Dim nomPC, Resultat
nomPC = " . "
Set objWMIService = GetObject (" winmgmts: " & _
" {impersonationLevel=impersonate}!\\ " & nomPC & " \root\cimv2 " )
Set colInstalledPrinters = _
objWMIService. execQuery (" Select * from Win32_Printer " )
For Each objPrinter In colInstalledPrinters
Resultat = Resultat & " Nom: " & objPrinter. Name & " active : " _
& objPrinter. Default & vbLf
Next
MsgBox Resultat
|
|
| auteur : SilkyRoad |
Cet exemple liste toutes les propriétés des imprimantes renvoyées pas la classe Win32_PrinterConfiguration :
VBS |
Dim objWMIService, colPrinters, objItem
Dim strComputer
On Error Resume Next
strComputer = " . "
Set objWMIService = GetObject (" winmgmts:\\ " & strComputer & " \root\cimv2 " )
Set colPrinters = objWMIService. ExecQuery (" Select * from Win32_PrinterConfiguration " )
For Each objItem In colPrinters
Wscript. echo " Caption: " & objItem. Caption & vbCR & _
" Collate: " & objItem. Collate & vbCR & _
" Color: " & objItem. Color & vbCR & _
" Copies: " & objItem. Copies & vbCR & _
" Description: " & objItem. Description & vbCR & _
" DeviceName: " & objItem. DeviceName & vbCR & _
" DisplayFlags: " & objItem. DisplayFlags & vbCR & _
" DisplayFrequency: " & objItem. DisplayFrequency & vbCR & _
" DitherType: " & objItem. DitherType & vbCR & _
" DriverVersion: " & objItem. DriverVersion & vbCR & _
" Duplex: " & objItem. Duplex & vbCR & _
" FormName: " & objItem. FormName & vbCR & _
" HorizontalResolution: " & objItem. HorizontalResolution & vbCR & _
" ICMIntent: " & objItem. ICMIntent & vbCR & _
" ICMMethod: " & objItem. ICMMethod & vbCR & _
" LogPixels: " & objItem. LogPixels & vbCR & _
" MediaType: " & objItem. MediaType & vbCR & _
" Nom: " & objItem. Name & vbCR & _
" Orientation: " & objItem. Orientation & vbCR & _
" PaperLength: " & objItem. PaperLength & vbCR & _
" PaperSize: " & objItem. PaperSize & vbCR & _
" PaperWidth: " & objItem. PaperWidth & vbCR & _
" BitsPerPel: " & objItem. BitsPerPel & vbCR & _
" PelsHeight: " & objItem. PelsHeight & vbCR & _
" PelsWidth: " & objItem. PelsWidth & vbCR & _
" PrintQuality: " & objItem. PrintQuality & vbCR & _
" Scale: " & objItem. Scale & vbCR & _
" SettingID: " & objItem. SettingID & vbCR & _
" SpecificationVersion: " & objItem. SpecificationVersion & vbCR & _
" TTOption: " & objItem. TTOption & vbCR & _
" VerticalResolution: " & objItem. VerticalResolution & vbCR & _
" XResolution: " & objItem. XResolution & vbCR & _
" YResolution: " & objItem. YResolution
Next
|
|
| auteur : SilkyRoad | VBS |
Dim objWMIService, colInstalledPrinters, objPrinter
Dim strComputer
strComputer = " . "
Set objWMIService = _
GetObject (" winmgmts:\\ " & strComputer & " \root\cimv2 " )
Set colInstalledPrinters = _
objWMIService. ExecQuery (" Select * from Win32_Printer " )
For Each objPrinter In colInstalledPrinters
objPrinter. CancelAllJobs
Next
Wscript. echo " OK "
Set objWMIService = Nothing
Set colInstalledPrinters = Nothing
|
|
Consultez les autres F.A.Q's
Les sources présentés sur cette pages sont libre de droits,
et vous pouvez les utiliser à votre convenance. Par contre cette page de présentation de ces sources constitue une oeuvre intellectuelle protégée par les droits d'auteurs.
Copyright ©2008
Developpez LLC. Tout droits réservés Developpez LLC.
Aucune reproduction, même partielle, ne peut être faite de ce site et de
l'ensemble de son contenu : textes, documents et images sans l'autorisation
expresse de Developpez LLC. Sinon vous encourez selon la loi jusqu'à 3 ans
de prison et jusqu'à 300 000 E de dommages et intérets.
Cette page est déposée à la SACD.
|