---- '''New stuff is organized into subpages...''' On April, 12. 2006 I did a big reorganization of my pages. Sorry for floating the recent changes list... * [Matthias Hoffmann - Tcl-Code-Snippets - tcom & wmi - Examples] * [Matthias Hoffmann - Tcl-Code-Snippets - Starkit/pack-related] (if not already on ''this'' unorganized page...) * [Matthias Hoffmann - Tcl-Code-Snippets - tclhttpd and cgi-related] * [Matthias Hoffmann - Tcl-Code-Snippets - wikit-related] * [Matthias Hoffmann - Tcl-Code-Snippets - misc routines] * [Matthias Hoffmann - Other Utilities] * [Matthias Hoffmann - PhotoPrinter] * [Matthias Hoffmann - Ideen] * [Matthias Hoffmann - Thoughts And Ideas] ---- '''A simple ADSI-Example using [tcom]:''' proc logEvent {evtType args} { # ohne Fehlernachricht catch { set wsh [::tcom::ref createobject "WScript.Shell"] $wsh LogEvent $evtType "[regsub -all {\n} $args { - }]" } } '''One more complicated example: return the available Windows-NT- and ADS-Domains and Workgroups as a list:''' proc GetDomains {} { set ret {} if [catch {::tcom::ref getobject "WinNT:"} d] then { return -code error " failed: $d" } else { ::tcom::foreach domain $d { if ![catch {::tcom::ref getobject [$domain ADsPath],domain}] { set ct (Domain) } else { set ct (Workgroup) } lappend ret [list [$domain Name] $ct] } } return $ret } '''And another one: get the''' '''''groups''''' '''of a given container (that is, a Domain or Workgroup):''' proc GetGroups {container {contype domain}} { set ret {} # get Domain-/Computerobject if [catch {::tcom::ref getobject "WinNT://$container,$contype"} g] then { return -code error " failed: $g" } ::tcom::foreach m $g { # instead of IF one can use a -filter here... if {[$m Class] == "Group"} { lappend ret [$m Name] } } return $ret } (''contype'' can be ''domain'' or ''computer'') '''And finally get the users within such a group:''' (...to be done...) ---- Reminder: * time to split this page into subpages to keep an overview of what's going on... - in progress meanwhile * More [ADSI]-Examples ---- Have you considered submitting these for inclusion in [tcllib]? M.H.: '''no''', I think I haven't yet reached the required level of tcl-knowledge ... ---- [Category Package]