Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Hugo Ranea
  Where is Hugo Ranea?
 Vancouver, BC
 Canada
 Hugo Ranea
 To: Saifuddin Tehami
  Where is Saifuddin Tehami?
 Lahore
 Pakistan
 Saifuddin Tehami
 Tags
Subject: RE: How is it possible to view "Computer Man
Thread ID: 209712 Message ID: 209756 # Views: 2 # Ratings: 1
Version: Visual FoxPro 9 Category: Network and Computer Management
Date: Tuesday, December 30, 2008 10:25:01 PM         
   


> Hi All,
>
> How is it possible to view "Computer Management->Shared Folders->Sessions" in a VFP form ?
>
> Saif


Saif,

Using LanmanServer object you can get both, Sessions and Open Files from Computer Management->Shared Folders

* Open Sessions
local loConnection, loSessions, loSession

lcServer			= "YourServerName"
loConnection			= GetObject("WinNT://" + lcServer + "/LanmanServer")
loSessions			= loConnection.Sessions()

create cursor C_Sessions ;
	( ;
		PK			I 		autoinc	, ;
		Computer		C(64)			, ;
		ConnectedTime		I			, ;
		IdleTime		I			, ;
		Name			C(64)			, ;
		User			C(64)			  ;
	)

For Each loSession in loSessions
	wait window 'Adding: ' + loSession.Name nowait
	with loSession
		try
			insert into C_Sessions ;
					(	;
						Computer				, ;
						ConnectedTime			, ;
						IdleTime				, ;
						Name					, ;
						User					  ;
					) ;
				values ;
					( ;
						.Computer				, ;
						.ConnectTime			, ;
						.IdleTime				, ;
						.Name					, ;
						.User					  ;
					)
		catch
		endtry
	endwith
endfor

wait window 'Creating indexes...' nowait

index on	PK			tag PK
index on	Computer	tag Computer
index on	Name		tag Name
index on	User		tag User

wait clear


* Open Files
local loConnection, loResources, loResource, llValid

lcServer			= "YourServerName"
loConnection			= GetObject("WinNT://" + lcServer + "/LanmanServer")
loResources			= loConnection.Resources()

create cursor C_Resources ;
	( ;
		PK		I Autoinc		, ;
		Name	C(240)			, ;
		User	C(64)			, ;
		Path	C(240)			, ;
		ADsPath	C(240)			, ;
		GUID	C(64)			, ;
		Schema	C(240)			, ;
		Locks	I				  ;
	)
		
For Each loResource in loResources
	with loResource
		try
			lcPath					= .Path
			llValid					= .t.
		catch
			llValid					= .f.
		endtry
		if llValid
			wait window 'Adding resource: ' + .Path nowait
			insert into C_Resources ;
					( ;
						User				, ;
						Name				, ;
						Path				, ;
						Locks				  ;
					) ;
				values ;
					( ;
						.User				, ;
						.Name				, ;
						.Path				, ;
						.LockCount			  ;
					)
		endif
	endwith
endfor

wait window 'Creating indexes...' nowait

index on	PK		tag PK
index on	Path		tag Path
index on	User		tag User

wait clear


"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges

ENTIRE THREAD

How is it possible to view "Computer Man Posted by Saifuddin Tehami @ 12/30/2008 2:49:38 PM
RE: How is it possible to view "Computer Man Posted by Yousfi Benameur @ 12/30/2008 4:03:40 PM
RE: How is it possible to view "Computer Man Posted by Hugo Ranea @ 12/30/2008 10:25:01 PM
RE: How is it possible to view "Computer Man Posted by Samir Ibrahim @ 12/31/2008 12:21:45 AM