Recent

Author Topic: Remote Desktop Log-where to start?  (Read 4046 times)

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Remote Desktop Log-where to start?
« on: October 06, 2018, 02:02:02 pm »
Hi all,

I'm considering to make a software to log on every PCs in local network.
I want to monitor every PC's memory usually and free disk space, this is one of my daily work.
I need this software so I can know if each PC's status in my office, it can save a lot of time to check each PC one by one, there are too many PCs in my company.

But I don't know how to start to do this?
I have experience to make program use TCP socket to transfer data between PC, but I never make program to remote log on one PC.

Is someone can help me how to start?

Thanks!
Jonvy

msnrw

  • Newbie
  • Posts: 4
Re: Remote Desktop Log-where to start?
« Reply #1 on: October 06, 2018, 04:13:37 pm »
Hey Jonvy,

can you give some insights about the OS of the Systems in question?

Maybe set up a client/server approach: gather infos to monitor with a client as service in background and send them to the monitor server.

Did you do a research? I think there might possibly a solution out of the box... no means to offend you, but before you reinvent the wheel??

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Re: Remote Desktop Log-where to start?
« Reply #2 on: October 06, 2018, 04:27:19 pm »
The OS is windows7 or Windows10.

msnrw

  • Newbie
  • Posts: 4
Re: Remote Desktop Log-where to start?
« Reply #3 on: October 07, 2018, 12:45:51 am »
Hi Jonvy,

for Win there is typeperf as a cli program:
https://superuser.com/questions/407750/command-line-resource-monitor-for-windows

With this you could tinker a proof of concept: execute it every x times from your own program. Cut the infos you need and send them to the other machine.

Hope this gets you started...

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Re: Remote Desktop Log-where to start?
« Reply #4 on: October 09, 2018, 03:22:40 am »
Thanks msnrw,

I use typeperf get the info I need, but looks like this tool can only works in local machine. If I use this tool to type remote PC name,it will get error.
 
In this way, I need make client/server program in both PC.

Is there any tools, so I can get directly remote PC's info?

Jonvy

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: Remote Desktop Log-where to start?
« Reply #5 on: October 09, 2018, 06:27:20 am »
This is more a windowsquestion than a pascal question.

All programs able to do this are in client server architekture. This is also a security rights problematic. Every Information you can query from another PC is evil, so it is normaly forbidden to get this and such info.

In windows you can query some infos by remote WMI, but this must be handled by the admins to make this possible. Because this can be a security risk and is normaly not used.
regards
Andreas

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Remote Desktop Log-where to start?
« Reply #6 on: October 09, 2018, 07:26:29 am »
Jonvy,

If you are not familiar with Powershell, you should probably look into it.  Powershell eases system administration quite a bit and can do a whole lot more than what you are asking for.  Another nice thing is, it is fairly easy to learn.

HTH
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Re: Remote Desktop Log-where to start?
« Reply #7 on: October 10, 2018, 04:24:44 pm »
Thanks 440bx,
I look into Powershell, it's very useful and can get information from remote PC.

I meet another problem when I using Powershell with Lazarus.
I want to get output from Powershell to my program.
But when I run following code, Powershell  doesn't return result and my program waiting, only when
I close Powershell, then my program can get result.
Can you help me where is wrong for my code?

Code as here:

procedure TForm1.btnPowerShellClick(Sender: TObject);
var
  Process2: TProcess;
begin
  Memo2.Clear;
  Process2:=TProcess.Create(Form1);
  Process2.Options:=[poUsePipes,poWaitOnExit,poStderrToOutPut];

  Process2.Executable:='PowerShell.exe';

  Process2.Parameters.Add('Get-WmiObject -Class Win32_BIOS -ComputerName .');

  Process2.Active:=True;

  Memo2.Lines.LoadFromStream(Process2.Output);

end;


440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Remote Desktop Log-where to start?
« Reply #8 on: October 10, 2018, 05:23:48 pm »
Thanks 440bx,
I look into Powershell, it's very useful and can get information from remote PC.
<snip>
Can you help me where is wrong for my code?
You're welcome, I'm pleased you found the suggestion useful. Unfortunately, I cannot offer any assistance with the  code you posted.  I do everything using the Windows API.  I have little to no knowledge of Lazarus components.

Hopefully the people knowledgeable with Lazarus components can help you with that.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Remote Desktop Log-where to start?
« Reply #9 on: October 10, 2018, 05:50:01 pm »
[...]  Powershell  doesn't return result and my program waiting, only when I close Powershell, then my program can get result.

I'm no expert either but I think you problem is with

Process2.Options:=[poUsePipes,poWaitOnExit,poStderrToOutPut];

IIRC, poWaitOnExit causes the callee to lock until the spawned process ends.
« Last Edit: October 10, 2018, 05:52:41 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018