• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1000
  • Last Modified:

UltraVNC start/stop script

My company is looking to move from pcAnyWhere to UltraVNC for remote support of desktops.  We have Ultra VNC set up and working on out test machines and are happy with the speed ease of use vs PCA.  My question is this.  With pcAnywhere, we had a vb script that we could run to remotely stop and start the awhost32 service in case the end user closed the Display Status window.  I want something like this for UltraVNC.  I have tried modifying the script to target uvnc_service instead of awhost32, but it does not seem to work.  I realize that it might not be an issue, but it is something that management would like to have available.

Do any of you use such scripts with VNC software, or have any other recommendations?

Thanks for looking!

The pcAnyWhere script is here:
===============================================================
dim svcName, sStart, sStop
dim service
dim objService
dim SvrName
dim input

input = Inputbox ("Server Name that you would like to Start or Stop PCAnywhere service on:", "Stop or start pcanywhere service")

SvrName = input
svcName = "awhost32"

Set service = GetObject("winmgmts:!\\" & svrName & "\root\cimv2")
svc = "Win32_Service=" & "'" & svcName & "'"
state = inputbox("Enter start or stop to Change the Status of PCAnywhere Service, (need to use lowercase)")

if state = "start" then
    Set objService = Service.Get(svc)
    retVal = objService.StartService()
elseif state = "stop" then
    Set objService = Service.Get(svc)
    retVal = objService.StopService()
end if
================================================================

My modified script for UltraVNC:
================================================================
dim svcName, sStart, sStop
dim service
dim objService
dim SvrName
dim input

input = Inputbox ("Server Name that you would like to Start or Stop UltraVNC service on:", "Stop or start UltraVNC service")

SvrName = input
svcName = "uvnc_service"

Set service = GetObject("winmgmts:!\\" & svrName & "\root\cimv2")
svc = "Win32_Service=" & "'" & svcName & "'"
state = inputbox("Enter start or stop to Change the Status of UltraVNC Service, (need to use lowercase)")

if state = "start" then
    Set objService = Service.Get(svc)
    retVal = objService.StartService()
elseif state = "stop" then
    Set objService = Service.Get(svc)
    retVal = objService.StopService()
end if
================================================================
0
minder49
Asked:
minder49
  • 2
1 Solution
 
IT_CrowdCommented:
I'm not very familiar with starting/stopping services in VBS, but I got it to work by calling a batch file with:
 -- stops service if running
Net Stop uvnc_service

Open in new window

   
 -- starts service if stopped
Net Start uvnc_service

Open in new window

0
 
IT_CrowdCommented:
I think this might be even better than the batch file:
http://stackoverflow.com/questions/187836/how-do-i-restart-a-service-on-a-remote-machine-in-windows

sc \\machine start uvnc_service

Open in new window

0
 
Ron MalmsteadInformation Services ManagerCommented:
You might consider using psexec as a matter of simplicity in avoiding WMI calls.

example...

psexec \\* Net Start uvnc_service

...would start the service on all machines in the domain that have it installed.
0
 
minder49Author Commented:
I can script this.  Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now