My goal is to retrieve all the alerts for a given domain user, in SP 2007, then delete these alerts.
I have referenced the following script on this site.
- In DEV environment, when I run the script I receive an access denied error and the script deletes the alerts.
- In Live environment, I receive the access denied error, but the script does not delete the alerts.
The access denied exception is:
The following exception was thrown when trying to enumerate the collection: "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))".
This exception happens when I loop the sites (webs) in a site collection. The line of code is:
$webs = $site.AllWebs
foreach ($web in $webs)
{...
Any ideas?