HP DesignJet Z6800 System Administrator s Guide - Page 39

strKeyPath = SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports

Page 39 highlights

HP DJ UPD SAG wscript.echo "The Folder "+ path +"does not exist." wscript.echo "Installation not done" wscript.quit(1) end if end function This function verifies if the local port given by the user ' already exists Function PortExists(portName) const HKEY_LOCAL_MACHINE = &H80000002 dim strKeyPath, oReg, arrValueNames, arrValueTypes, i, found found = false Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports" oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes For i=0 To UBound(arrValueNames) if arrValueNames(i) = portName then found = true exit for end if Next PortExists = found end function Function Ping (hostAddress) Dim colPingResults, objPingResult, strQuery, respond respond = False ' Define the WMI query strQuery = "SELECT * FROM Win32_PingStatus WHERE Address = '" & hostAddress & "'" ' Run the WMI query Set colPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery( strQuery ) ' Translate the query results to either True or False For Each objPingResult In colPingResults If Not IsObject( objPingResult ) Then respond = False ElseIf objPingResult.StatusCode = 0 Then respond = True Else respond = False End If Next Ping = respond Set colPingResults = Nothing End Function This function displays help message sub ShowHelp() 39

  • 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
39
wscript.echo "The Folder "+ path +"does not exist."
wscript.echo "Installation not done"
wscript.quit(1)
end if
end function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This function verifies if the local port given by the user
' already exists
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function PortExists(portName)
const HKEY_LOCAL_MACHINE = &H80000002
dim strKeyPath, oReg, arrValueNames, arrValueTypes, i, found
found = false
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports"
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes
For i=0 To UBound(arrValueNames)
if arrValueNames(i) = portName then
found = true
exit for
end if
Next
PortExists = found
end function
Function Ping (hostAddress)
Dim colPingResults, objPingResult, strQuery, respond
respond = False
' Define the WMI query
strQuery = "SELECT * FROM Win32_PingStatus WHERE Address = '" & hostAddress & "'"
' Run the WMI query
Set colPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery( strQuery )
' Translate the query results to either True or False
For Each objPingResult In colPingResults
If Not IsObject( objPingResult ) Then
respond = False
ElseIf objPingResult.StatusCode = 0 Then
respond = True
Else
respond = False
End If
Next
Ping = respond
Set colPingResults = Nothing
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This function displays help message
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
sub ShowHelp()