ผมเคยเจอเหตุการณ์หนึ่งที่ลูกค้าต้องการ Block การใช้งาน Office 365 ให้กับพนักงานที่พึ่งลาออกไป ทั้งแผนก!!!!! หรือสงสัยว่าพนักงานคนนี้ มีความชอบมาพากล โดยปกติเราสามารถใช้ GUI ทำได้ครับ แต่ทำทีละคน
การ Block Access บริการทุกบริการยังมีอยู่ครับ แต่ User ไม่สามารถเข้าใช้งานได้ ดังนั้นไม่ต้องกลัวว่าอีเมลจะหายไป

วิธีการ block รายบุคคล
Set-MsolUser -UserPrincipalName user1@mvpskill.com -BlockCredential $true
วิธีการ un-block รายบุคคล
Set-MsolUser -UserPrincipalName user1@mvpskill.com -BlockCredential $false
วิธีการ block หลายๆคน
1. ให้สร้างไฟล์ Text แล้วกรอกอีเมล และทำการบันทึก
[email protected]
[email protected]
[email protected]
2. พิมพ์คำสั่งนี้
Get-Content "C:\My Documents\Accounts.txt" | Set-MsolUser -UserPrincipalName $_.UserPrincipalName -BlockCredential $true
3. วิธีการ un-block หลายๆคนทีเดียว
Get-Content "C:\My Documents\Accounts.txt" | Set-MsolUser -UserPrincipalName $_.UserPrincipalName -BlockCredential $false












![[M365Tricks] This file cannot be previewed because there is no previewer installed for it.](https://www.mvpskill.com/wp-content/uploads/2020/04/image-19-100x70.png)



