Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 $_}
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Add -Confirm:$false after -Identity $_

This way you will not be asked to confirm the action

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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