Working with public folders in Exchange 2003 is a lot better than working with them in earlier versions of Exchange, due to the enhancements of WMI. The addition of new and expanded WMI classes makes working with public folders especially easy. The script ExchangePublicFolders.vbs illustrates this point. As you can see from the code listing, much of the process of connecting to and accessing useful information about Exchange 2003 public folders via the Exchange_PublicFolder class is similar to this process in other WMI scripts. Indeed, the only changes are using the Exchange_PublicFolder class to select the statement you will use for the query and, of course, the Output information section of the script.
Option Explicit
On Error Resume Next
Dim strComputer
Dim wmiNS
Dim wmiQuery
Dim objWMIService
Dim colItems
Dim objItem
strComputer = "."
wmiNS = "\root\MicrosoftExchangeV2"
wmiQuery = "Select * from Exchange_PublicFolder"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
Set colItems = objWMIService.ExecQuery(wmiQuery)
For Each objItem In colItems
WScript.Echo "AddressBookName: " & objItem.AddressBookName
WScript.Echo "AdministrativeNote: " & objItem.AdministrativeNote
WScript.Echo "AdminSecurityDescriptor: " _
& objItem.AdminSecurityDescriptor
WScript.Echo "ADProxyPath: " & objItem.ADProxyPath
WScript.Echo "AssociatedMessageCount: " _
& objItem.AssociatedMessageCount
WScript.Echo "AttachmentCount: " & objItem.AttachmentCount
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "CategorizationCount: " & _
objItem.CategorizationCount
WScript.Echo "Comment: " & objItem.Comment
WScript.Echo "ContactCount: " & objItem.ContactCount
WScript.Echo "ContainsRules: " & objItem.ContainsRules
WScript.Echo "CreationTime: " & objItem.CreationTime
WScript.Echo "DeletedItemLifetime: " _
& objItem.DeletedItemLifetime
WScript.Echo "Description: " & objItem.Description
WScript.Echo "FolderTree: " & objItem.FolderTree
WScript.Echo "FriendlyUrl: " & objItem.FriendlyUrl
WScript.Echo "HasChildren: " & objItem.HasChildren
WScript.Echo "HasLocalReplica: " & objItem.HasLocalReplica
WScript.Echo "InstallDate: " & objItem.InstallDate
WScript.Echo "IsMailEnabled: " & objItem.IsMailEnabled
WScript.Echo "IsNormalFolder: " & objItem.IsNormalFolder
WScript.Echo "IsPerUserReadDisabled: " _
& objItem.IsPerUserReadDisabled
WScript.Echo "IsSearchFolder: " & objItem.IsSearchFolder
WScript.Echo "IsSecureInSite: " & objItem.IsSecureInSite
WScript.Echo "LastAccessTime: " & objItem.LastAccessTime
WScript.Echo "LastModificationTime: " _
& objItem.LastModificationTime
WScript.Echo "MaximumItemSize: " & objItem.MaximumItemSize
WScript.Echo "MessageCount: " & objItem.MessageCount
WScript.Echo "MessageWithAttachmentsCount: " _
& objItem.MessageWithAttachmentsCount
WScript.Echo "Name: " & objItem.Name
WScript.Echo "NormalMessageSize: " & objItem.NormalMessageSize
WScript.Echo "OwnerCount: " & objItem.OwnerCount
WScript.Echo "ParentFriendlyUrl: " & objItem.ParentFriendlyUrl
WScript.Echo "Path: " & objItem.Path
WScript.Echo "ProhibitPostLimit: " & objItem.ProhibitPostLimit
WScript.Echo "PublishInAddressBook: " _
& objItem.PublishInAddressBook
WScript.Echo "RecipientCountOnAssociatedMessages: " _
& objItem.RecipientCountOnAssociatedMessages
WScript.Echo "RecipientCountOnNormalMessages: " _
& objItem.RecipientCountOnNormalMessages
WScript.Echo "ReplicaAgeLimit: " & objItem.ReplicaAgeLimit
WScript.Echo "ReplicaList: " & objItem.ReplicaList
WScript.Echo "ReplicationMessagePriority: " _
& objItem.ReplicationMessagePriority
WScript.Echo "ReplicationSchedule: " _
& objItem.ReplicationSchedule
WScript.Echo "ReplicationStyle: " & objItem.ReplicationStyle
WScript.Echo "RestrictionCount: " & objItem.RestrictionCount
WScript.Echo "SecurityDescriptor: " & objItem.SecurityDescriptor
WScript.Echo "Status: " & objItem.Status
WScript.Echo "StorageLimitStyle: " & objItem.StorageLimitStyle
WScript.Echo "TargetAddress: " & objItem.TargetAddress
WScript.Echo "TotalMessageSize: " & objItem.TotalMessageSize
WScript.Echo "Url: " & objItem.Url
WScript.Echo "UsePublicStoreAgeLimits: " _
& objItem.UsePublicStoreAgeLimits
WScript.Echo "UsePublicStoreDeletedItemLifetime: " _
& objItem.UsePublicStoreDeletedItemLifetime
WScript.Echo "WarningLimit: " & objItem.WarningLimit
WScript.Echo "-=-"
Next