here is my modified script:
$web = Get-SPWeb "http://site/subsite"; $web.allowUnsafeUpdates = 'true';
and this is the error I get (I use the German localized version of the server and sharepoint):
Fehler bei der Enumeration einer Auflistung: Collection was modified; enumeration operation may not execute.. Bei C:\stopwf.ps1:7 Zeichen:3 + <<<< $web.Lists | foreach { + CategoryInfo : InvalidOperation: (Microsoft.Share...on+SPEnumerator:SPEnumerator) [], RuntimeException + FullyQualifiedErrorId : BadEnumeration
The runnig script user is the administrator on the machine, he himself, sitecollection admin and sql-admin. I also created a child node with this account, so I don't think access problems would be a problem.
I found this answer ( Differences between PowerShell and C # when listing a collection ), but I don’t understand how to use this information for me ?!
source share