Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skip SystemMailbox users in Active Directory script

Status
Not open for further replies.

bob000

Programmer
Aug 23, 2001
20
US
In the script below, I would like to check for and skip outputing
SystemMailbox users. How can this be done? Also, what are
SystemMailbox user accounts used for?

Bob Mendgik
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'List Users Home in Active Directory
'
Set WSHNetwork = CreateObject("WScript.Network")

Domain = "<some domain>"

Set DomainObj = GetObject("WinNT://" & Domain)
DomainObj.Filter = Array("User")

For Each UserObj in DomainObj
Wscript.Echo UserObj.Name

Next

MsgBox " Done "
 
Hello bob000,

To skip something of this kind, use instr()
[tt]
For Each UserObj in DomainObj
if instr(UserObj.Name,"SystemMailBox",1)=0 then
Wscript.Echo UserObj.Name
end if
Next
[/tt]
regards - tsuji
 
Amendments:

Forgot to put the first optional parameter into the instr() which is needed when vbTextCompare is specified. Here is the correction.
[tt]
For Each UserObj in DomainObj
if instr([red]1,[/red]UserObj.Name,"SystemMailBox",1)=0 then
Wscript.Echo UserObj.Name
end if
Next
[/tt]
- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top