Write-Error -ErrorAction Stop stop foreach chain RRS feed

  • Question

  • Hello,

    i create functions and use them one by one for each user. In function I use Write-Error -ErrorAction Stop for prevent script action if found some problems in function.

    If an error occurs for one user, the whole process of processing the user list is terminated.

    I what stop function is some problem, but only for current user. Here script:

    here was long script (remove it)

    When function move-profile return error ForEach ($user in $tripUser) - terminate for each user instead only one user with error.

    Friday, June 28, 2019 1:09 AM


All replies