Problem is you can have two or three NIC
Code:

Dim $NIC, $IPAddress
$NIC = 0
While EnumIPInfo($NIC,0,0)
$IPAddress = EnumIPInfo($NIC,0,0)
; Install Printers
$NIC = $NIC + 1
Loop


I want to recommend the IsInSubnet UDF to find in which network the workstation is (Thanks Jens "Sealeopard")
Code:

Select
Case IsInSubnet($IPAddress, '192.168.35.0', '255.255.255.0')
; Do something with printers
Case IsInSubnet($IPAddress, '192.168.36.0', '255.255.255.0')
; Do something with printers
Case 1
; Maybe something else
EndSelect


For Citrix or Terminal Server, I want to recommend wtsmanager.dll
See http://www.kixhelp.com/downloads.htm, the simple COM-wrapper for Terminal Services Manager
Code:

If @TSSESSION
$oWts = CreateObject("WTSManager.Shell")
$IPAddress = $oWts.MyIPAddress
If $IPAddress = ""
; Most probably WTSManager.dll is not registered on this terminal server
Exit 0
EndIf
; Do stuff with printers
EndIf


I hope this helps. I am interested in your solution to install printers for your users.


Edited by Witto (2006-08-09 10:32 PM)