' This script was originally published in the Exchange Cookbook, ' (http://www.exchangebookcook.com). Written by Paul Robichaux, ' Missy Koslosky, and Devin Ganger. Redistributed with permission ' of the publisher, O'Reilly & Associates. ' This code toggles the mail-enabled status of the selected folder. ' ------ SCRIPT CONFIGURATION ------ strComputerName = "" ' e.g., "cyclone" strPubFolderPath = "" ' e.g., "/Some Folder/" ' ------ END CONFIGURATION --------- strE2K3WMIQuery = "winmgmts://" & strComputerName &_ "/root/MicrosoftExchangeV2" ' query for the specific folder we want Set wmiService = GetObject(strE2K3WMIQuery) query = "Select * From Exchange_PublicFolder" & " Where Path='" & _ strPubFolderPath & "'" Set targetFolder = wmiService.ExecQuery(query) ' report on the mail-enabled status, then toggle it For Each folder In targetFolder If folder.IsMailEnabled Then WScript.Echo folder.Name &_ " was mail-enabled as " & folder.TargetAddress & "; disabling it" folder.IsMailEnabled = false Else WScript.Echo folder.Name &_ " is not mail-enabled; enabling it" folder.IsMailEnabled = true End If Folder.Put_ Next WScript.Echo "Done processing folders."