a Script for automatic answer 'Y' on powershell, no need user response

Highlighted
New Contributor

Hi All,

 

I'm new to Powershell.

 

I try to run this script Remove-DistributionGroupMember -Identity "group name" -member "email member" on Powershell. every time I run this script I will get a response to typing 'Y'. Is there any complete script so I don't need to type 'Y'? I've tried added Echo Y but it's not working.

 

Thanks.

2 Replies
Highlighted

That's why we have the -Confirm switch. And as a new to PowerShell, do yourself a favor and make a habit of checking the help for any cmdlet you want to run. 

Highlighted

@litaalota 

 

This is the command

Remove-DistributionGroupMember -Identity MyDisGroup -Member administrator -Confirm:$false