0

I have a foreach loop in powershell to delete all deleted sites that are already in recycle bin of SharePoint. But when I run this loop it asks me weather I'm sure to do this or not for every single item.

How can I bypass this approval in my foreach statements in general?

Get-SPDeletedSite | ForEach-Object {Remove-SPDeletedSite -identity $_}
1

Add -Confirm:$false after -Identity $_

This way you will not be asked to confirm the action

  • thanks for your response, it says that confirmation is canceled in the current loop, am I right ? – Pouyan Sep 21 '13 at 10:48
  • You will not be asked to confirm the deletion done in the loop yes – Robert Lindgren Sep 21 '13 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.