Page 1 of 1 1
Topic Options
#69940 - 2002-09-17 01:00 PM Remote VNC admin
Vig Offline
Starting to like KiXtart

Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
Thought I'd share something I've been messing around with.

This is a script that will install the VNC server on a remote machine, connect to the server eith the client VNC program, and then remove all trace of VNC on the remote computer once the client program is terminated.

Variables that need to be changed:
$DTPath = "" The path to deltree.exe. Example: "C:\programs"
$computer = "" The remote computer name. Example: "MyServer"
$VNCNET = "" The network path to the VNC server files. Example: "\\Server1\VNC"
$VNCView = "" The path to vncviewer.exe. Example: "C:\programs"
$EnPass = "" The encrypted password (remove all commas).
$XNetPath = "" The path to Xnet.exe (comes with kixtart) Example: "C:\programs"

Setup:
Download and install VNC. Install the WinVNC service (this is necessary to extract the encrypted password). Start the WinVNC service and input the default password. Open up regedit and copy the HKLM\Software\ORL\WinVNC3\Default\Password value (this is the encrypted password that you will need to put in the script).

Copy omnithread_rt.dll WinVNC.exe and VNCHooks.dll to a network share (these are the WinVNC server files). You can now uninstall WinVNC service if you wish.

I had to word wrap a couple shell statements to keep the post from going way wide. Just a heads up, not sure if the word wrap will affect the script.

code:
Break on
$DTPath = ""
$computer = ""
$VNCNET = ""
$VNCView = ""
$EnPass = ""
$XNetPath = ""

Shell '%comspec% /c $XNetPath\xnet list "\\$Computer\VNC Server" | find /i "VNC Server" > XnetVnc.dat'
If GetFileSize("XnetVnc.dat") <> 0 ?"Cannot run because VNC Server is installed on $computer" Exit EndIf

Shell '%comspec% /c $XNetPath\xnet list \\$Computer\VNCAdmin | find /i "VNCAdmin" > XnetVnc.dat'
If GetFileSize("XnetVnc.dat") <> 0 Shell '%comspec% /c $XNetPath\xnet stop \\$Computer\VNCAdmin' Shell '%comspec% /c $XNetPath\xnet remove
\\$Computer\VNCAdmin /y' EndIf

If Exist("\\$computer\c$\Program Files\ORL") <> 1
MD"\\$computer\c$\Program Files\ORL" If @ERROR <> 0 ?@SERROR Exit EndIf EndIf

If Exist("\\$computer\c$\Program Files\ORL\VNCAdmin") <> 1
MD"\\$computer\c$\Program Files\ORL\VNCAdmin" If @ERROR <> 0 ?@SERROR Exit EndIf EndIf

If Exist("\\$computer\c$\Program Files\ORL\VNCAdmin\omnithread_rt.dll") <> 1
Copy "$VNCNET\omnithread_rt.dll" "\\$computer\c$\Program Files\ORL\VNCAdmin\" If @ERROR <> 0 ?@SERROR Exit EndIf EndIf

If Exist("\\$computer\c$\Program Files\ORL\VNCAdmin\WinVNC.exe") <> 1
Copy "$VNCNET\WinVNC.exe" "\\$computer\c$\Program Files\ORL\VNCAdmin\" If @ERROR <> 0 ?@SERROR Exit EndIf EndIf

If Exist("\\$computer\c$\Program Files\ORL\VNCAdmin\VNCHooks.dll") <> 1
Copy "$VNCNET\VNCHooks.dll" "\\$computer\c$\Program Files\ORL\VNCAdmin\" If @ERROR <> 0 ?@SERROR Exit EndIf EndIf

Shell '%comspec% /c $XNetPath\xnet install \\$computer\VNCAdmin /b:"C:\Progra~1\ORL\VNCAdmin\WinVNC.exe -service" /n:VNCAdmin /u:LocalSystem
/i:yes /s:demand | find /i "successfully" > XnetVnc.dat'
If GetFileSize("XnetVnc.dat") = 0 ?"Error installing service on $computer" Exit EndIf
$nul = AddKey("\\$computer\HKLM\Software\ORL")
$nul = AddKey("\\$computer\HKLM\Software\ORL\VNC")
$nul = AddKey("\\$computer\HKLM\Software\ORL\VNC\3.3.3")
$nul = AddKey("\\$computer\HKLM\Software\ORL\WinVNC3")
$nul = AddKey("\\$computer\HKLM\Software\ORL\WinVNC3\Default")
$nul = AddKey("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL")
$nul = AddKey("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs")
$nul = AddKey("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","SocketConnect","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","AutoPortSelect","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","InputsEnabled","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","LocalInputsDisabled","0","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","IdleTimeout","0","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","QuerySetting","2","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","QueryTimeout","10","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","Password","$EnPass","REG_BINARY")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","PollUnderCursor","0","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","PollForeground","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","PollFullScreen","0","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","OnlyPollConsole","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKLM\Software\ORL\WinVNC3\Default","OnlyPollOnEvent","0","REG_DWORD")
$nul = WriteValue("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe","use_GetUpdateRect","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe","use_Timer","0","REG_DWORD")
$nul = WriteValue("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe","use_KeyPress","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe","use_LButtonUp","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe","use_MButtonUp","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe","use_RButtonUp","1","REG_DWORD")
$nul = WriteValue("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL\VNCHooks\Application_Prefs\WinVNC.exe","use_Deferral","1","REG_DWORD")
Shell '%comspec% /c $XNetPath\xnet start \\$Computer\VNCAdmin'
Sleep 2
:GetResponse
Beep
?"TYPE 'I' FOR INTERACTIVE OR 'N' FOR NON-INTERACTIVE"?
Get $Response
Select
Case $response = "i"
Shell '%comspec% /c $VNCView\vncviewer.exe -noshared $computer'
Case $response = "n"
Shell '%comspec% /c $VNCView\vncviewer.exe -viewonly -noshared $computer'
Case 1 Goto GetResponse
EndSelect
Shell '%comspec% /c $XNetPath\xnet stop \\$Computer\VNCAdmin'
Sleep 1
Shell '%comspec% /c $XNetPath\xnet remove \\$Computer\VNCAdmin /y'
If DelTree("\\$computer\HKLM\Software\ORL") <> 0 ?"Error deleting HKLM ORL subkey" EndIf
If DelTree("\\$computer\HKEY_USERS\.DEFAULT\Software\ORL") <> 0 ?"Error deleting .Default ORL subkey" EndIf
Shell '%comspec% /c $DTPath\Deltree.exe /Y "\\$computer\c$\Program Files\ORL"'

Hope it works for you.

[ 17. September 2002, 13:03: Message edited by: Vig ]

Top
#69941 - 2002-09-17 02:40 PM Re: Remote VNC admin
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Nice [Smile]

Could come handy [Smile]
_________________________
The tart is out there

Top
#69942 - 2002-09-18 02:22 AM Re: Remote VNC admin
Redback Offline
Getting the hang of it

Registered: 2002-03-20
Posts: 71
Loc: Albury Wodonga, Australia
Check out the systemtools.com remote control manager, it does these things

Find it Here

Top
#69943 - 2002-09-18 07:00 AM Re: Remote VNC admin
Vig Offline
Starting to like KiXtart

Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
Thanks but no thanks.
Top
#69944 - 2002-09-18 04:58 PM Re: Remote VNC admin
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
Try mine on fer size...

First, download the self extracting executable [ here ].

Second modify the IP's in the C:\VNC\HKLMS.reg file according to your network. You will also have to modify the password entrys in the HKCU.reg, HKLM.reg, and HKLMS.reg to your likeing.

You will notice that the reg files are 'REGEDIT4' format, this format can be imported into Windows NT 4.0, Windows 2000, Windows XP, and even Windows 9X. (Although this script won't work on 9X, but you could use these in a login script.)

Third, run the shortcut that got placed on your desktop.

You will notice that you get prompted for the PC name. You are also promted to ask the user for permission to connect.

Have fun,
Rocco

[ 18. September 2002, 17:03: Message edited by: Rocco Capra ]
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1635 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.055 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org