Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - VBScript to dentify which mailboxes have forwarding active.

Reply
 
Old 09-22-2009   #1 (permalink)
Dennis Too


 
 

VBScript to dentify which mailboxes have forwarding active.

Hi Guys,

Was wondering do you guys have any good VB script to perform the above
mentioned subject?

I've my own VB script but the excel spreadsheet still show the attribute of
the domain. Was wondering any way to exclude the attribute?

The below is the script e.g

'Global variables
Dim oContainer
Dim OutPutFile
Dim FileSystem
Dim tempStr
'On Error Resume Next

'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("marketing.txt", True)
Set oContainer=GetObject("LDAP://OU=Company Users,DC=Company,DC=com")

'Enumerate Container
EnumerateUsers oContainer

'Clean up
OutPutFile.Close
Set FileSystem = Nothing
Set oContainer = Nothing
WScript.Echo "Finished"
WScript.Quit(0)
Sub EnumerateUsers(oCont)

Dim oUser, TabStop, NewLine

TabStop = Chr(9)
NewLine = Chr(10)

'OutPutFile.WriteLine "Name,Designation,Department,Telephone,Fax,Email"

For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"

tempStr = trim(oUser.displayName) & ";" &
trim(oUser.extensionAttribute15) _
& ";" & trim(oUser.Description) _
& ";" & trim(oUser.Department) & ";" & trim(oUser.mobile) _
& ";" & trim(oUser.altRecipient) & ";" & trim(oUser.mail) _
& ";" & trim(oUser.telephoneNumber) & ";" & trim(oUser.sAMAccountName)

'WScript.Echo trim(oUser.sAMAccountName)
if oUser.displayName <> "Sunit Chhabra" Then
if oUser.protocolSettings <> "" then
'WScript.Echo trim(oUser.displayName)
tempStr = tempStr & ";" & trim(CSTR(oUser.protocolSettings))
else
tempStr = tempStr & ";" & "<Not Set>"
end if
Else
tempStr = tempStr & ";" & "Enabled"
End IF

OutPutFile.WriteLine tempStr

Case "organizationalunit" , "container"
EnumerateUsers oUser
End Select
Next

End Sub

Regards,

DT


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
VBScript - Add additional Mailboxes VB Script
can VBScript determine the active tab of a dialog? VB Script
retrieve Active cell "Name" vbscript VB Script
vbscript to access all the exchange server mailboxes all at once VB Script
mailboxes Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46