View previous topic :: View next topic |
Author |
Message |
wooish Newbie
Joined: 28 May 2004 Posts: 3
|
Posted: Sun May 30, 2004 5:52 pm Post subject: Get System Info from a remote computer |
|
|
Hello
I'm new to the forum and a newbie to VDS. With VDS 5, can you get system info (free memory, disk space etc..) from a remote computer? I would like to retrieve system information from a specific workstation on the network.
Thanks |
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Mon May 31, 2004 9:26 am Post subject: |
|
|
Hello, and welcome to the VDSWORLD forums
You cannot get information directly from the remote computer; you'll have to set up a tcp/ip client or server at that specific computer using the vdsipp (shareware) or the vdsinet extension.
You then can connect to that remote computer (or let it connect to your computer, depending on if you set up the server at your computer or at the remote), and can use some basic commands to retrieve the values.
I've posted a very basic script below; you can modify it to suit your needs.
Server (remote computer):
Code: |
#
# This script needs to be runned at the remote computer
#
option decimalsep, ","
option errortrap, error
external vdsipp.dll
#define command, internet
#define function, internet
%%TCP_Port = @input(TCP/IP Port, 2)
if @not(%%TCP_Port)
stop
end
DIALOG CREATE,RemoteInfo - server,-1,0,317,81
DIALOG ADD,BUTTON,stop,30,97,137,24,Stop
DIALOG SHOW
internet tcp-server, create, 1
internet tcp-server, activate, 1, %%TCP_Port
:evloop
:tcp-server1onconnect
:tcp-server1ondisconnect
wait event
goto @event()
:tcp-server1onmessage
%%Command = @internet(tcp-server, message, 1)
%%UserId = @internet(tcp-server, userid, 1)
if @equal(%%Command, FREE_MEM)
internet tcp-server, senduser, 1, %%UserId, @sysinfo(freemem)
elsif @equal(%%Command, FREE_DISC_SPACE)
internet tcp-server, senduser, 1, %%UserId, @volinfo(C:, f)
elsif @equal(%%Command, SCREEN_WIDTH)
internet tcp-server, senduser, 1, %%UserId, @sysinfo(screenwidth)
elsif @equal(%%Command, SCREEN_HEIGHT)
internet tcp-server, senduser, 1, %%UserId, @sysinfo(screenheight)
elsif @equal(%%Command, PIX_PER_INCH)
internet tcp-server, senduser, 1, %%UserId, @sysinfo(pixperin)
else
warn Unknown command: %%Command
end
goto evloop
:error
warn Error: @error(e)@cr()Line: @error(n)
goto close
:stopBUTTON
:close
internet tcp-server, destroy, 1
stop
|
Client (local computer):
Code: |
#
# This script needs to be runned at your local computer
#
option decimalsep, ","
option errortrap, error
external vdsipp.dll
#define command, internet
#define function, internet
%%TCP_Server = @input(TCP Server, 127.0.0.1)
if %%TCP_Server
%%TCP_Port = @input(TCP Port, 2)
if @not(%%TCP_Port)
stop
end
end
internet tcp, create, 1
# Turn threads off, so the script will halt when connecting
internet tcp, threads, 1, off
# Connect to the server
internet tcp, connect, 1, %%TCP_Server, %%TCP_Port
# Now turn threads on again, so the extension will generate events when a message is send etc
internet tcp, threads, 1, on
# Show a message when we aren't connected
if @zero(@internet(tcp, connected, 1))
warn Cannot connect to TCP/IP server running at %%TCP_Server:%%TCP_Port
goto close
end
DIALOG CREATE,RemoteInfo,-1,0,388,160
DIALOG ADD,BUTTON,getFreeMem,24,26,150,24,Get free memory
DIALOG ADD,BUTTON,getFreeDiscSpace,55,26,150,24,Get free disc space at C:\
DIALOG ADD,BUTTON,getScreenWidth,87,27,150,24,Get screenwidth
DIALOG ADD,BUTTON,getScreenHeight,24,212,150,24,Get screenheight
DIALOG ADD,BUTTON,getPixPerInch,55,212,150,24,getPixPerInch
DIALOG ADD,STATUS,status
DIALOG SHOW
:evloop
wait event
goto @event()
:getFreeMemBUTTON
dialog set, status, Sending command...
internet tcp, send, 1, FREE_MEM
goto evloop
:getFreeDiscSpaceBUTTON
dialog set, status, Sending command...
internet tcp, send, 1, FREE_DISC_SPACE
goto evloop
:getScreenWidthBUTTON
dialog set, status, Sending command...
internet tcp, send, 1, SCREEN_WIDTH
goto evloop
:getScreenHeightBUTTON
dialog set, status, Sending command...
internet tcp, send, 1, SCREEN_HEIGHT
goto evloop
:getPixPerInchBUTTON
dialog set, status, Sending command...
internet tcp, send, 1, PIX_PER_INCH
goto evloop
:tcp1onmessage
info Returned value: @internet(tcp, message, 1)
goto evloop
:tcp1onsenddone
dialog set, status, Command has been sent
goto evloop
:tcp1ondisconnect
warn Connection with server lost
goto close
:error
warn Error: @error(e)@cr()Line: @error(n)
goto close
:close
internet tcp, destroy, 1
|
Regards,
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
wooish Newbie
Joined: 28 May 2004 Posts: 3
|
Posted: Mon May 31, 2004 7:54 pm Post subject: |
|
|
Thanks for the reply and help. Looks like I'm gonna have to spend some times trying to understand what the script does. Thanks again. |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Jun 01, 2004 1:32 am Post subject: |
|
|
Hi The script is server/client code to communicate system information.
I don't believe you can remotely retrieve system information without having
installed a server program on the remote computer. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
wooish Newbie
Joined: 28 May 2004 Posts: 3
|
Posted: Tue Jun 01, 2004 2:33 am Post subject: |
|
|
That's sad to hear I wish VDS is able to do that without running client/server software. I wish to write a program where I can do the above mentioned task without having to login to that particular server or workstation. |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Jun 01, 2004 10:40 am Post subject: |
|
|
It's not a limitation of VDS itself, rather, I don't believe Windows has support
for any programming language to do what you want to do. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Jun 04, 2004 11:44 pm Post subject: |
|
|
Guess again FF,
The Windows API can do this. There are multiple ways to do this but by far the easiest way would be to use the SNMP (Simple Network Management Protocol). Unfortunately for VDS there is no code written yet to take advantage of SNMP. Hopefully we will have something soon for this It would be a pretty big order to do this but it can be done. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Sat Jun 05, 2004 8:44 am Post subject: |
|
|
Hm... now you mentioned that SNMP term; I thought X-Tools was writing
a program that used that protocol. You could ask him for some examples _________________ phpBB Development Team |
|
Back to top |
|
|
Rebel49 Contributor
Joined: 23 Aug 2002 Posts: 78 Location: Nova Scotia, Canada
|
Posted: Sat Jun 05, 2004 1:38 pm Post subject: |
|
|
I have had some success with SNMP and VDS4.
Using VDSIPP, (UDP) I have assembled SNMP
packets byte by byte, frame by frame and successfully
retrieved information from remote hosts. Its a bit
crude but it does work! I get the data I want.
I wonder though if the described information (disk space, etc)
is actually available through a SNMP MIB. If so, I haven't as yet
come across that detail.
REB _________________ OLD and eager! |
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Fri Jun 11, 2004 8:06 pm Post subject: |
|
|
Hi All,
I don't know for sure but i think Tommy wrote a dll that could read a remote registry. i think most of the data in question is probably available there.
I am pretty sure when reading the registry remotely you would need to have a valid acct w/ appropriate user rights on the machine being accessed. I'm not sure about SNMP but it would be a little scary to find out that any of that type of system information would be available without having the user request validated in some way.
moke |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jun 14, 2004 1:28 pm Post subject: |
|
|
moke wrote: | I'm not sure about SNMP but it would be a little scary to find out that any of that type of system information would be available without having the user request validated in some way.
moke |
Moke,
You still would need a valid Administrator's account on the remote machine for SNMP to work. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Sanjuro Contributor
Joined: 01 May 2003 Posts: 59 Location: Norfolk-United Kingdom
|
Posted: Wed Jun 23, 2004 10:39 am Post subject: |
|
|
Long time since i was last here, very busy.
Not too sure on the details but if you want to extract system info or any info for that matter from a remote machine using WMI (Windows Management Instrumentation). This can be acheived via a VB script. but critically is also available in command line format as WMIC.
See the tech net article here
http://www.microsoft.com/technet/prodtechnol/windows2000serv/maintain/featusability/wmic.mspx
You may be able to invoke this through a wrapper built around WMIC to build your command line strings.
Cheers
Sanjuro _________________ "Apparently three out of four people make up 75 percent of the population. |
|
Back to top |
|
|
Rebel49 Contributor
Joined: 23 Aug 2002 Posts: 78 Location: Nova Scotia, Canada
|
Posted: Tue Jul 06, 2004 3:22 pm Post subject: |
|
|
I wrote
Quote: | I wonder though if the described information (disk space, etc)
is actually available through a SNMP MIB. If so, I haven't as yet
come across that detail.
|
Apparently that detail is described in host.mib file available
on XP and W2000 systems.
Not present in windows 98 so thats why I was unaware of
that cabability.
A fair amount of info is available viathat MIB.
REB _________________ OLD and eager! |
|
Back to top |
|
|
Rebel49 Contributor
Joined: 23 Aug 2002 Posts: 78 Location: Nova Scotia, Canada
|
Posted: Tue Jul 06, 2004 3:38 pm Post subject: |
|
|
dragonsphere wrote:
Quote: | Moke,
You still would need a valid Administrator's account on the remote machine for SNMP to work.
|
I don't think that is necessarily true. Although there are definate
safeguards and protection built into SNMP service, it can be
and often is wide open to the world. I know i can retrieve
SNMP data from certain PCs without security authentication.
By default, many SNMP devices are wide open.
Of course If you enable SNMP service, security should
be considered and set up accordingly.
REB _________________ OLD and eager! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|