HP DesignJet Z5400 System Administrator s Guide - Page 33

reg.SetStringValue HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports, portName

Page 33 highlights

HP DJ UPD SAG if configVerbosity = 1 then wscript.echo strShellLine end if lShellResults = objShell.Run(strShellLine,1,True) if lShellResults = 1 then wscript.echo "Error on driver instalation. Contact with your IT administrator" ShowHelp end if end function This function allows the user to add new TCPIPport on computer ' Input Params: ' - hostAddress: The IP address or hostname of the port ' - portName: Name of the port ' Output Parms: ' - N/A Public Function AddTCPIPPort(hostAddress, portName) Dim objWMIService, objNewPort Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set objNewPort = objWMIService.Get ("Win32_TCPIPPrinterPort").SpawnInstance_ objNewPort.Name = portName objNewPort.Protocol = 1 objNewPort.HostAddress = hostAddress objNewPort.PortNumber = "9100" objNewPort.SNMPEnabled = False objNewPort.Put_ End Function This function allows the user to add new LOCALport on computer ' Input Params: ' - portName: Name of the local port ' Output Parms: ' - N/A Public Function AddLocalPort(portName) Dim wmiSvc, spooler, reg Const HKLM = &h80000002 Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2") Set spooler = wmiSvc.Get("Win32_Service.Name='spooler'") Set reg = GetObject("winmgmts:root\default:StdRegProv") spooler.StopService reg.SetStringValue HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports", portName, "" spooler.StartService End Function This function recover the params gived by user ' Input Params: ' - N/A ' Output Parms: 33

  • 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
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

HP DJ UPD SAG
33
if configVerbosity = 1 then
wscript.echo strShellLine
end if
lShellResults = objShell.Run(strShellLine,1,True)
if lShellResults = 1 then
wscript.echo "Error on driver instalation. Contact with your IT administrator"
ShowHelp
end if
end function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This function allows the user to add new TCPIPport on computer
' Input Params:
' - hostAddress: The IP address or hostname of the port
' - portName: Name of the port
' Output Parms:
' - N/A
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function AddTCPIPPort(hostAddress, portName)
Dim objWMIService, objNewPort
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set objNewPort = objWMIService.Get ("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = portName
objNewPort.Protocol = 1
objNewPort.HostAddress = hostAddress
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This function allows the user to add new LOCALport on computer
' Input Params:
' - portName: Name of the local port
' Output Parms:
' - N/A
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function AddLocalPort(portName)
Dim
wmiSvc, spooler, reg
Const HKLM = &h80000002
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
Set spooler = wmiSvc.Get("Win32_Service.Name='spooler'")
Set reg = GetObject("winmgmts:root\default:StdRegProv")
spooler.StopService
reg.SetStringValue HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports", portName, ""
spooler.StartService
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This function recover the params gived by user
' Input Params:
' - N/A
' Output Parms: