SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-1676806%22%20slang%3D%22en-US%22%3Ea%20Script%20for%20automatic%20answer%20'Y'%20on%20powershell%2C%20no%20need%20user%20response%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1676806%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20new%20to%20Powershell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20try%20to%20run%20this%20script%20Remove-DistributionGroupMember%20-Identity%20%22group%20name%22%20-member%20%22email%20member%22%20on%20Powershell.%20every%20time%20I%20run%20this%20script%20I%20will%20get%20a%20response%20to%20typing%20'Y'.%20Is%20there%20any%20complete%20script%20so%20I%20don't%20need%20to%20type%20'Y'%3F%20I've%20tried%20added%20Echo%20Y%20but%20it's%20not%20working.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1676806%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdvanced%20Threat%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1676918%22%20slang%3D%22en-US%22%3ERe%3A%20a%20Script%20for%20automatic%20answer%20'Y'%20on%20powershell%2C%20no%20need%20user%20response%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1676918%22%20slang%3D%22en-US%22%3E%3CP%3EThat's%20why%20we%20have%20the%20-Confirm%20switch.%20And%20as%20a%20new%20to%20PowerShell%2C%20do%20yourself%20a%20favor%20and%20make%20a%20habit%20of%20checking%20the%20help%20for%20any%20cmdlet%20you%20want%20to%20run.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1677686%22%20slang%3D%22en-US%22%3ERe%3A%20a%20Script%20for%20automatic%20answer%20'Y'%20on%20powershell%2C%20no%20need%20user%20response%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1677686%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F796822%22%20target%3D%22_blank%22%3E%40litaalota%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20the%20command%3C%2FP%3E%3CP%3ERemove-DistributionGroupMember%20-Identity%20%3CEM%3EMyDisGroup%3C%2FEM%3E%20-Member%20%3CEM%3Eadministrator%3C%2FEM%3E%20%3CSTRONG%3E-Confirm%3A%24false%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
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.

4 Replies

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. 

best response confirmed by litaalota (New Contributor)
Solution

@litaalota 

 

This is the command

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