If you need to remove
a group of users, You can once again use the CSV file. In fact, if you want to
remove the users you just created, it is super simple. All you need to do is to use the Remove-MsolUser cmdlet instead of the New-MSOlUser cmdlet. you want also want to use the –Force parameter. If you do not, the command
will prompt for each user, which is probably not what you want to do. Here is the
command without the –Force parameter:
PS C:\> $users = Import-Csv
C:\fso\Office365Users.CSV
PS C:\> $users | ForEach-Object { Remove-MsolUser
-UserPrincipalName $_.userprincipalname}
Confirm
Continue with this operation?
[Y] Yes [N] No [S] Suspend [?] Help
(default is "Y"):
So instead, you use
the –Force parameter as shown here:
$users | ForEach-Object { Remove-MsolUser
-UserPrincipalName $_.userprincipalname -Force}
No output returns
from this command.
No comments:
Post a Comment