Page 1 of 1 1
Topic Options
#188783 - 2008-07-16 11:16 AM How to use kix in a offline situation
ICTHumares Offline
Just in Town

Registered: 2008-07-16
Posts: 1
I need to use kix in a offline situation (laptop) those anywone know how to check if the laptop is online or offline so i can go to a other script
Top
#188784 - 2008-07-16 11:21 AM Re: How to use kix in a offline situation [Re: ICTHumares]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
you could implement a simple ping-check on a host only available online, and if it doesn't respond ..

And welcome btw! ;\)


Edited by Björn (2008-07-16 11:22 AM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#188785 - 2008-07-16 11:25 AM Re: How to use kix in a offline situation [Re: ICTHumares]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
WMI can do that for you.
Below is an example. It takes ages to complete but it's just a quick and dirty one.

 Code:
$wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_NetworkConnection")

For Each $wmiObj in $wmiColl
	? $wmiObj.ConnectionState
Next
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#188790 - 2008-07-16 12:36 PM Re: How to use kix in a offline situation [Re: Mart]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
I'd recommend :
 Code:
Function OSPing($sComputer)
  Shell '"'+%COMSPEC%+'" /c ping -n 1 '+$sComputer+' |find /C "TTL=" >nul'
  $OSPing = NOT @ERROR
EndFunction


From the OSPing (http://www.kixtart.org/udf), made by Les.

Hm, by offline / online - do you refer to off-site, or a disconnected nic?


Edited by Björn (2008-07-16 12:44 PM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#188799 - 2008-07-16 05:15 PM Re: How to use kix in a offline situation [Re: Björn]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
 Originally Posted By: Björn

....
Hm, by offline / online - do you refer to off-site, or a disconnected nic?


Hmmm.......that's a good one Björn. Maybe it's just logged on locally but still plugged into the LAN. My suggestion would say that you are connected to because basically the system is connected.
Maybe the original poster can clarify his/her needs a bit.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#188816 - 2008-07-18 09:35 AM Re: How to use kix in a offline situation [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Win32_PingStatus ;\)

 Code:
$Address = "10.31.1.12"
$objWMIService = GetObject("winmgmts:\\.\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select ResponseTime From Win32_PingStatus Where Address='" + $Address + "'")
For Each $objItem In $colItems
  If (VarTypeName($objItem.StatusCode) = 'Null') Or $objItem.StatusCode
    Exit $objItem.StatusCode
  Else
    ? $objItem.ResponseTime
  EndIf
Next

Top
Page 1 of 1 1


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

Who's Online
0 registered and 884 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

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

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