That is not ideal, but better than what I have now (that is... nothing)No
but if you have a list of possible hosts you can built a function to return true if you can connect to viz
What would be the command to check if a Viz is running in a specific IP?No
but if you have a list of possible hosts you can built a function to return true if you can connect to viz
for i = 120 to 150
host = "192.168.109."&i
result = QuerySingle (host,"0 VERSION \0")
Msgbox host&" - "&result
next
On Error Resume Next
for i = 126 to 145
host = "192.168.109."&i
result = "Not Found"
Err.Clear
result = QuerySingle (host,"0 VERSION \0")
Msgbox host&" - "&result
next
On Error Goto 0
you can try running a ps1 script that will check if viz is running, write the result to a file and then commmunicate only with the machines that viz is running on.I'm trying now with
Code:On Error Resume Next for i = 126 to 145 host = "192.168.109."&i result = "Not Found" Err.Clear result = QuerySingle (host,"0 VERSION \0") Msgbox host&" - "&result next On Error Goto 0
And it works without errors. But, for the machines that don't have Viz or Viz is not running, it takes a long time trying to get an answer. So, simply checking 20 machines, takes a LOOOOOONG TIME. Is there any way to make this faster?
param (
[string]$computerName
)
$processName = "viz" # Replace with the actual process name
$outputFile = "C:\temp\runningViz.txt"
try {
$process = Get-Process -ComputerName $computerName -Name $processName -ErrorAction Stop
if ($process) {
"$processName is running on $computerName." | Out-File $outputFile
}
else {
"$processName is not running on $computerName." | Out-File $outputFile
}
}
catch {
"$processName is not running on $computerName." | Out-File $outputFile
}
Sub TWUniButton1Click(Sender)
Dim machines
machines = Array("127.1.1.1","192.168.109.126", "192.168.109.127") ' Example IPs
Dim i, objShell, command, outputFile, fileSystem, fileContents
Set objShell = CreateObject("WScript.Shell")
outputFile = "C:\temp\runningViz.txt"
For i = 0 To UBound(machines)
' Construct PowerShell command
command = "powershell.exe -File C:\Temp\isVizRuning.ps1 -computerName " & machines(i)
' Run the PowerShell script
objShell.Run command, 0, True
Next
command = "powershell.exe -File C:\Temp\isVizRuning.ps1 -computerName localhost"
objShell.Run command, 0, True
Timer1.Enabled = true
Set objShell = Nothing
Set fileSystem = Nothing
End sub
Sub Timer1Timer(Sender)
Timer1.Enabled = false
TWUniMemo1.lines.LoadFromFile "C:\temp\runningViz.txt"
msgbox "loaded"
End sub
I realized that your proces must have admin rights in order to get the powerShell to comunicate with other computers on the netThank you so much, @adishin
In the ps1 code, it says that...
$processName = "viz" # Replace with the actual process name
My processes are these:
View attachment 92211
What name should I assign to the variable $processName ?
I realized that your proces must have admin rights in order to get the powerShell to comunicate with other computers on the net