we dont have active directory and we have to do it non actively which stinks because microsoft makes it damn near impossible other wise but we do have ping.kix Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0038)http://www.ensight.org/images/ping.kix -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY><PRE>Function Ping($ws)
$timeout = 5000 ;in milliseconds (up to 20000)
$machine = $ws
SHELL '%Comspec% /e:1024 /C ping ' + $machine + ' -n 1 -w ' + $timeout + ' | find /C "TTL=" > nul'
IF @error = 0
$Ping=1
ELSE
$Ping=0
ENDIF
EndFunction
</PRE></BODY></HTML>
as well as netview2.kix,
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0042)http://www.ensight.org/images/netview2.kix -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY><PRE>;FUNCTION NetView2()
;
;AUTHOR Jens Meyer (sealeopard@usa.net)
;
;CONTRIBUTOR Shawn Tassie
;
;ACTION Enumerate all announced computers in your domain
;
;VERSION 1.2 (fixed bug in SHELL string)
;1.1
;
;DATE CREATED 2002/05/14
;
;DATE MODIFIED 2003/05/31
;
;KIXTART 4.12+
;
;SYNTAX NetView2([Domain,Comment])
;
;PARAMETERS DOMAIN
;Specifies the domain to enumerate. If domain is omitted, returns a
;list of all announced computers in the current domain.
;
;COMMENT
;Optional boolean to determine whether to return the associated computer
;comment (separated by a comma from the computername)
;
;RETURNS
;An array of strings representing all the computers in the domain
;
;REMARKS
;This UDF returns a list of computers that are PINGable. Computers, that
;are members of the domain but are currently not connected to the domain,
;will not be listed. For a list of joined computers independent of whether
;they are on- or off-line use COMNetView().
;
;Slightly improved version of Shawn's NetView() UDF
;at http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=print_topic;f=12;t=000059
;
;DEPENDENCIES
;none
;
;EXAMPLE
;for each $computer in netview2()
; ? ''+$computer
;next
;
;KIXTART BBS
;http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000202
;
function NetView2(optional $domain, optional $commentflag)
dim $array[255]
dim $redim, $i, $j, $tempfile
dim $filehandle, $retcode, $line
dim $name, $comment
$redim = 255
$i = 0
$j = 0
$tempfile = '%temp%\netview.tmp'
if $domain
$domain = '/domain:'+trim($domain)
endif
if vartype($commentflag)
$commentflag=val($commentflag)
else
$commentflag=0
endif
if exist($tempfile)
del $tempfile
endif
shell '%comspec% /c net view '+$domain+' >"'+$tempfile+'"'
if @error = 0
$filehandle=freefilehandle()
$retcode=open($filehandle,$tempfile)
for $j = 1 to 5
$line = readline($filehandle) ; skip headings
next
while @error = 0
$name= trim(substr($line,3,instr($line,' ')-1))
$comment = trim(right($line,len($line)-instr($line,' ')))
if $commentflag
$array[$i]=$name+','+$comment
else
$array[$i]=$name
endif
$i=$i+1
if $i = $redim
$redim=$redim*2
redim preserve $array[$redim]
endif
$line = readline($filehandle)
loop
$retcode=close($filehandle)
del $tempfile
if $i
redim preserve $array[$i-4]
$netview2 = $array
exit @error
endif
endif
$netview2 = 0
exit @error
endfunction
</PRE></BODY></HTML>
comnet.kix,
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0044)http://www.ensight.org/images/comnetview.kix -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY><PRE>;FUNCTION COMNetView()
;
;ACTION Enumerate all joined computers in a domain
;
;AUTHOR Jens Meyer (sealeopard@usa.net)
;
;VERSION 1.3 (added error codes, changes variable redim algorithm)
; 1.2
;
;DATE CREATED 2002/05/14
;
;DATE MODIFIED 2003/06/24
;
;KIXTART 4.12+
;
;SYNTAX COMNetView([Domain])
;
;PARAMETERS DOMAIN
; Specifies the domain to enumerate. If domain is omitted, returns a
; list of all joined computers in the current domain.
;
;RETURNS An array of strings representing all the computers in the domain
;
;REMARKS This function returns all computers that have joined the specified domain
; independent of whether the computer is on- or off-line. It will not return
; computers running the Windows 9x operating system since they technically do
; not join the domain. To include Windows 9x computers in this list, please use
; either NetView() or NetView2()
;
;DEPENDENCIES none
;
;EXAMPLE for each $computer in COMNetView()
; ? ''+$computer
; next
;
;KIXTART BBS http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000201
;
Function COMNetView(optional $domain)
Dim $list, $objDomain, $objComputername, $filter[0]
; this function seems to only work on Windows 2000/XP computers
; even in a Windows NT 4.0 domain
if val(@INWIN)<>1 or val(@DOS)<5
exit 196
endif
$domain = trim($domain)
if $domain=''
$domain=@DOMAIN
endif
$filter[0]='Computer'
$objDomain = GetObject('WinNT://' + $domain + ',domain')
if @ERROR
exit @ERROR
endif
$objDomain.Filter=$filter
if @ERROR
exit @ERROR
endif
For Each $objComputername In $objDomain
redim preserve $list[ubound($list)+1]
$list[ubound($list)] = $objComputername.Name
Next
$objDomain = 0
$COMNetView = $list
exit @ERROR
EndFunction</PRE></BODY></HTML>
and osid.kix
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0038)http://www.ensight.org/images/osid.kix -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY><PRE>;==================================================================================================
Function osid(optional $sComp)
Dim $osidarray[13]
Dim $iINWIN, $sDOS, $iBUILD, $sCSD, $iPRODUCTSUITE, $sPRODUCTTYPE
Dim $operating_system, $sp_level, $os_suite, $os_short, $productsuite
Dim $os_type, $os_role, $os_flavor, $os_subver, $regkey
Dim $os_build, $os_proc, $os_owner, $os_org, $os_key, $os_date, $os_oem
Dim $os_lang, $os_producttype, $os_longbuild
Dim $LongHornBuild[4], $Win2003Build[9], $iBuildnumber, $asBuildList
Dim $WinXPBuild[9], $Win2000Build[7]
$LongHornBuild[0]='internal release',3670,3683,4008
$LongHornBuild[1]='Alpha Preview 3',4015
$LongHornBuild[2]='Alpha Preview 2',4008
$LongHornBuild[3]='Developer Preview',4051
$LongHornBuild[4]='RTM'
$Win2003Build[0]='Whistler Server preview release',2250
$Win2003Build[1]='Whistler Server alpha',2257
$Win2003Build[2]='Whistler Server interim release',2267,2410.2469
$Win2003Build[3]='Windows .NET Server interim release',3541,3604,3615,3621,3628,3660
$Win2003Build[4]='Windows .NET Server beta 3',3590
$Win2003Build[5]='Release Candidate 1',3663
$Win2003Build[6]='Release Candidate 2',3718
$Win2003Build[7]='internal release',3757
$Win2003Build[8]='escrow build',3763
$Win2003Build[9]='RTM',3790
$WinXPBuild[0]='Whistler pre-alpha',2223.1
$WinXPBuild[1]='Whistler preview',2250
$WinXPBuild[2]='Whistler alpha',2257
$WinXPBuild[3]='Whistler inetrim release',2267,2410,2416,2419
$WinXPBuild[4]='Whistler beta 1',2296
$WinXPBuild[5]='interim release',2428,2432,2446,2465,2469,2475,2481,2486,2494,2496,2526,2535,2542
$WinXPBuild[6]='Beta 2',2462
$WinXPBuild[7]='Release Candidate 1',2502
$WinXPBuild[8]='Release Candidate 2',2520
$WinXPBuild[9]='RTM',2545,2600
$Win2000Build[0]='Beta 1',1671
$Win2000Build[1]='Beta 2',1515
$Win2000Build[2]='Beta 2 Release Candidate',1859
$Win2000Build[3]='interim release',1868,1773
$Win2000Build[4]='Beta 3',2031
$Win2000Build[5]='Beta 3 Release Candidate 2',2128
$Win2000Build[6]='Release Candidate 3',2183
$Win2000Build[7]='RTM',2195
$sComp=Trim($sComp)
Select
Case $sComp=@WKSTA
$sComp=''
Case $sComp AND NOT KeyExist('\\'+$sComp+'\HKLM')
Exit 2
Case $sComp
$sComp='\\'+$sComp+'\'
EndSelect
; fetch all macro info depending on whether it's remote or local
If $sComp
If KeyExist($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList')
$iINWIN=1
$sDOS=ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','CurrentVersion')
$iBUILD=ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','CurrentBuildNumber')
$sCSD=ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','CSDVersion')
If $sDOS='4.0' AND ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\Q246009','Installed')
$sCSD=$sCSD+'a'
EndIf
$sPRODUCTTYPE=ReadValue($sComp+'HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions','ProductType')
Select
Case $sPRODUCTTYPE='WinNT'
If $sDOS='4.0'
$sPRODUCTTYPE='Workstation'
Else
$sPRODUCTTYPE='Professional'
EndIf
Case $sPRODUCTTYPE='ServerNT'
If $sDOS='5.2'
$sPRODUCTTYPE=''
Else
$sPRODUCTTYPE='Server'
EndIf
Case $sPRODUCTTYPE='LANManNT'
$sPRODUCTTYPE='Domain Controller'
Case 1
$sPRODUCTTYPE='Home Edition'
EndSelect
$sPRODUCTTYPE=ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','ProductName')+' '+$sPRODUCTTYPE
$sPRODUCTTYPE=Join(Split($sPRODUCTTYPE,'Microsoft'),'')
$iPRODUCTSUITE=''
$os_lang=$sComp+Join(Split(ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','SystemRoot'),':\'),'$\')+'\system32\shell32.dll'
$os_lang=GetFileVersion($os_lang,'Language')
Else
$iINWIN=2
$dDOS=ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion','VersionNumber')
$dDOS=Split($dDOS,'.')
$iBUILD=$dDOS[Ubound($dDOS)]
ReDim preserve $dDOS[1]
$sDOS=Join($dDOS,'.')
$sCSD=''
$iPRODUCTSUITE=''
$sPRODUCTTYPE=ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion','Version')
$os_lang=Right(''+ReadValue($sComp+'HKLM\SYSTEM\CurrentControlSet\Control\Nls\Locale',''),4)
EndIf
Else
$iINWIN=@INWIN
$sDOS=@DOS
$iBUILD=@BUILD
$sCSD=@CSD
$iPRODUCTSUITE=@PRODUCTSUITE
$sPRODUCTTYPE=@PRODUCTTYPE
$os_lang=@SYSLANG
EndIf
; set the correct registry key
If $iINWIN=1
$regkey='HKLM\Software\Microsoft\Windows NT\CurrentVersion'
Else
$regkey='HKLM\Software\Microsoft\Windows\CurrentVersion'
EndIf
If $sComp
$regkey=$sComp+$regkey
EndIf
; retrieve registered owner, organization, build, type
$os_owner=ReadValue($regkey,'RegisteredOwner')
$os_org=ReadValue($regkey,'RegisteredOrganization')
$os_proc=ReadValue($regkey,'CurrentType')
$os_build=Val($iBUILD)
Select
Case $iINWIN=1
; determine the operating system kernel
Select
Case $sDOS='6.0'
$operating_system='Windows Longhorn'
For $iBuildnumber=0 to Ubound($LongHornBuild)
$asBuildList=$LongHornBuild[$iBuildNumber]
If AScan($asBuildList,$os_build)+1
$os_longbuild=$asBuildList[0]
EndIf
Next
$os_short='WinLonghorn'
$os_key=ReadValue($regkey,'ProductID')
Case $sDOS='5.2'
$operating_system='Windows Server 2003'
$os_short='Win2K3'
$os_key=ReadValue($regkey,'ProductID')
For $iBuildnumber=0 to Ubound($Win2003Build)
$asBuildList=$Win2003Build[$iBuildNumber]
If AScan($asBuildList,$os_build)+1
$os_longbuild=$asBuildList[0]
EndIf
Next
Case $sDOS='5.1'
$operating_system='Windows XP'
For $iBuildnumber=0 to Ubound($WinXPBuild)
$asBuildList=$WinXPBuild[$iBuildNumber]
If AScan($asBuildList,$os_build)+1
$os_longbuild=$asBuildList[0]
EndIf
Next
$os_short='WinXP'
$os_key=ReadValue($regkey,'ProductID')
Case $sDOS='5.0'
$operating_system='Windows 2000'
For $iBuildnumber=0 to Ubound($Win2000Build)
$asBuildList=$Win2000Build[$iBuildNumber]
If AScan($asBuildList,$os_build)+1
$os_longbuild=$asBuildList[0]
EndIf
Next
$os_short='Win2k'
$os_key=ReadValue($regkey,'ProductID')
Case $sDOS='4.0'
$operating_system='Windows NT 4.0'
$os_short='WinNT'
$os_key=ReadValue($regkey,'ProductID')
$os_key=Left($os_key,5)+'-'+SubStr($os_key,6,3)+'-'+SubStr($os_key,10,7)+'-'+Right($os_key,5)
Case 1
$operating_system='unknown'
$os_short='unknown'
EndSelect
; determine the service pack level
$sp_level=$sCSD
If InStr($sp_level,'Service Pack')
$sp_level=Split($sp_level,'Service Pack')
$sp_level=Trim($sp_level[Ubound($sp_level)])
Else
$sp_level=0
EndIf
; determine the product suite
$productsuite=Val($iPRODUCTSUITE)
$os_suite=''
If $productsuite
If $productsuite = 1
$os_suite=$os_suite+'Small Business |'
EndIf
If $productsuite = 2
$os_suite=$os_suite+'Enterprise |'
EndIf
If $productsuite = 4
$os_suite=$os_suite+'BackOffice |'
EndIf
If $productsuite = 8
$os_suite=$os_suite+'Communication Server |'
EndIf
If $productsuite = 16
$os_suite=$os_suite+'Terminal Server |'
EndIf
If $productsuite = 32
$os_suite=$os_suite+'Small Business (Restricted) |'
EndIf
If $productsuite = 64
$os_suite=$os_suite+'Embedded NT |'
EndIf
If $productsuite = 128
$os_suite=$os_suite+'DataCenter |'
EndIf
If $productsuite = 256
$os_suite=$os_suite+'Single User Terminal Server |'
EndIf
If $productsuite = 512
$os_suite=$os_suite+'Home Edition |'
EndIf
If $productsuite = 1024
$os_suite=$os_suite+'Blade Server |'
EndIf
If InStr($os_suite,'|')
$os_suite=Left($os_suite,Len($os_suite)-2)
EndIf
EndIf
; determine the producy type
$os_type=$sPRODUCTTYPE
Select
Case InStr($os_type,'Domain Controller')
$os_type='Domain Controller'
$os_role='Domain Controller'
$os_flavor='Server'
Case InStr($os_type,'Server')
$os_type='Server'
$os_role='Member Server'
$os_flavor='Server'
Case InStr($os_type,'Workstation')
$os_type='Workstation'
$os_role='Workstation'
$os_flavor='Workstation'
Case InStr($os_type,'Professional')
$os_type='Professional'
$os_role='Workstation'
$os_flavor='Workstation'
Case InStr($os_type,'Tablet PC')
$os_type='Tablet PC'
$os_role='Workstation'
$os_flavor='Tablet PC'
Case InStr($os_type,'Home Edition')
$os_type='Home Edition'
$os_role='Workstation'
$os_flavor='Workstation'
Case 1
$os_type='unknown'
$os_role='unknown'
$os_flavor='unknown'
EndSelect
; create the @PRODUCTTYPE macro
$os_producttype=Join(Split($operating_system+' '+$os_type,'4.0 '),'')
$operating_system=$os_producttype
; add pre-RTM build info to OS description
If $os_longbuild AND $os_longbuild<>'RTM'
$operating_system=$operating_system+' (build '+$os_build+', '+$os_longbuild+')'
EndIf
; add service pack info to OS description
If $sp_level
$operating_system=$operating_system+' Service Pack '+$sp_level
EndIf
If $os_suite<>''
$operating_system=$operating_system+' ['+$os_suite+']'
EndIf
; determine the installation date
$os_date=ReadValue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','Installdate')
; determine the OEM Duplicator String
$os_oem=ReadValue($sComp+'HKLM\System\Setup','OemDuplicatorString')
Case $iINWIN=2
$os_short='Win9x'
$os_role='Workstation'
$sp_level=0
$os_subver=Lcase(ReadValue($regkey,'SubVersionNumber'))
Select
Case $sDOS='4.90'
$operating_system='Windows ME'
$os_key=ReadValue($regkey,'ProductKey')
$os_flavor=''
Case $sDOS='4.10'
$operating_system='Windows 98'
$os_key=ReadValue($regkey,'ProductKey')
Select
Case InStr($os_subver,'c')
$os_flavor='SE'
Case InStr($os_subver,'b')
$os_flavor='B'
Case $os_subver=' a '
$os_flavor='Second Edition'
Case 1
$os_flavor='OEM'
EndSelect
Case $sDOS='4.0'
$operating_system='Windows 95'
$os_key=ReadValue($regkey,'ProductID')
Select
Case InStr($os_subver,'c')
$os_flavor='OSR 2.5'
Case InStr($os_subver,'b')
$os_flavor='OSR 2.0'
Case InStr($os_subver,'a')
$os_flavor=' Service Pack 1'
Case 1
$os_flavor=' OEM'
EndSelect
Case 1
$operating_system='unknown'
$os_short='unknown'
EndSelect
$os_producttype=$operating_system
If $os_flavor
$operating_system=$operating_system+' '+$os_flavor
EndIf
EndSelect
IF $os_short="Win2k"
IF InStr($operating_system,"server")
$os_short="Win2000"
ENDIF
ENDIF
$osidarray[0]=$operating_system
$osidarray[1]=$os_short
$osidarray[2]=$os_role
$osidarray[3]=$sp_level
$osidarray[4]=$os_build
$osidarray[5]=$os_proc
$osidarray[6]=$os_owner
$osidarray[7]=$os_org
$osidarray[8]=$os_key
$osidarray[9]=$os_date
$osidarray[10]=$os_oem
$osidarray[11]=$os_lang
$osidarray[12]=$os_producttype
$osidarray[13]=$os_longbuild
$osid=$osidarray
EndFunction</PRE></BODY></HTML>