How to skip confirmation for each user in exchange powershell

Rounak 60 Reputation points


I use exchange powershell to update user details. But after installing the new Exchange module, it is asking for confirmation when i type a command, but it keeps asking for confirmation even though i enter A (Yes to All).
Sharing the Script below for your reference and attaching the snap too.

import-csv "C:\Reports\Org\Title.csv" | foreach {Set-User -Identity $.UPN -Title $.Title}
import-csv "C:\Reports\Org\Department.csv" | foreach {Set-User -Identity $.UPN -Department $.Department}

import-csv "C:\Reports\Org\Manager.csv" | foreach {Set-User -Identity $.UPN -Manager $.Manager}Powershell.png
Please advice?

Microsoft Exchange Online
{count} votes

Accepted answer
  1. Jarvis Sun-MSFT 6,841 Reputation points Microsoft Vendor

    @Rounak ,

    As above AnZa's comment has mentioned:

    Based on your description, it seems that the new module is prompting for confirmation even when you enter “A” (Yes to All) while executing a command. This could be due to the -Confirm parameter being set to true by default in the new module.

    To suppress the confirmation prompt, you can add the -Confirm:$false parameter to your commands. Here’s an example:

    import-csv "C:\Reports\Org\Title.csv" | foreach {Set-User -Identity $.UPN -Title $.Title -Confirm:$false}

    You can use this syntax for all your commands to suppress the confirmation prompt.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful