?
Solved

UltraVNC start/stop script

Posted on 2012-09-06
4
Medium Priority
?
922 Views
Last Modified: 2012-09-10
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
Comment
Question by:minder49
  • 2
4 Comments
 
LVL 13

Expert Comment

by:IT_Crowd
ID: 38372582
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
 
LVL 13

Accepted Solution

by:
IT_Crowd earned 2000 total points
ID: 38372593
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
 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 38373624
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
 
LVL 3

Author Closing Comment

by:minder49
ID: 38384409
I can script this.  Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This video teaches viewers about errors in exception handling.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses
Course of the Month16 days, 12 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question