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 Answer 1

1

Add -Confirm:$false after -Identity $_

This way you will not be asked to confirm the action

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.