PowerShell คือ Shell Script ที่ Microsoft สร้างขึ้นมาเพื่อใช้ในการควบคุมการทำงานหลายๆผลิตภัณฑ์ของ Microsoft บางครั้งรูปแบบการควบคุมการทำงาน ไม่สามารถทำได้บนระบบ GUI(Graphical User Interface) จึงจำเป็นที่จะต้องใช้ PowerShell เข้ามาช่วย ในระบบ Microsoft 365 บางครั้งสิ่งที่เราต้องการควบคุม ไม่สามารถทำได้บนระบบ GUI ดังนั้นจึงจำเป็นที่จะต้องใช้ PowerShell Script เนื้อหาในบทความนี้จะเป็น จะรวบรวม PowerShell Script ที่ใช้กับ Microsoft 365 ที่ทางเน็ตเวย์เก็บรวบรวมไว้ใช้เอง และเพื่อเผยแพร่ให้ทุกคนสามารถนำไปประยุกต์ใช้กับ Microsoft 365 ได้ กรณีเครื่องคอมพิวเตอร์ยังไม่มีโปรแกรม PowerShell หรือยังไม่สามารถใช้งาน PowerShell ได้ ให้ตรวจสอบการติดตั้งจากข้อมูล วิธีการติดตั้ง PowerShell สำหรับเชื่อมต่อ Microsoft 365 admin หลายครั้ง Script ที่เราต้องการใช้ หาไม่พบบน PowerShell จำเป็นที่จะต้องเปิด Session ของ Services นั้นๆเสียก่อนเสียก่อนเพื่อเรียกใช้งาน โดยวิธีการคือต้องเปิด PowerShell ในสิทธิ์ admin โดยทำการคลิ๊กขวาที่โปรแกรมแล้วเลือก run as administrator หลังจากนั้นใช้คำสั่งตามรายละเอียดด้านล่าง เริ่มใช้งาน ให้ทำการ Connect to Exchange Online PowerShell (ทำทุกครั้ง) $UserCredential = Get-Credential$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirectionSet-ExecutionPolicy RemoteSignedImport-PSSession $Session -DisableNameChecking Add-Remove alias Microsoft 365 Group Get-UnifiedGroup -Identity | select-object displayname,Emailaddresses | FLSet-UnifiedGroup -Identity -EmailAddresses @{Add="address@yourdomain.com"}Set-UnifiedGroup -Identity -EmailAddresses @{Remove="address@yourdomain.com"} Set TimeZone Get-Mailbox -ResultSize Unlimited | Get-MailboxRegionalConfigurationGet-Mailbox -ResultSize Unlimited | Set-MailboxRegionalConfiguration -TimeZone <"Time Zone">Get-MailboxRegionalConfiguration Set-MailboxRegionalConfiguration -TimeZone <"Time Zone">กรณีประเทศไทยให้ใส่ค่า -TimeZone "SE Asia Standard Time"Time Zones: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones Set Language Get-Mailbox -ResultSize Unlimited | Get-MailboxRegionalConfigurationGet-Mailbox -ResultSize Unlimited | Set-MailboxRegionalConfiguration -DateFormat <"Date Format"> -Language Get-MailboxRegionalConfiguration Set-MailboxRegionalConfiguration -DateFormat <"Date Format"> -Language กรณีภาษาไทยให้ใส่ค่า -DateFormat "dd MMM yyyy" -Language th-THLanguage: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-input-locales-for-windows-language-packs Change Address mail group Get-UnifiedGroup #เพื่อตรวจสอบว่ามี Group ใดอยู่บ้างSet-UnifiedGroup -Identity -PrimarySmtpAddress ตัวอย่างSet-UnifiedGroup -Identity ITSGroup -PrimarySmtpAddress ITS-New@netway.co.th Upgrade distribution lists to Microsoft 365 Groups Get-DistributionGroup #เพื่อตรวจสอบว่ามี Group ใดอยู่บ้างUpgrade-DistributionGroup -DlIdentities \ตัวอย่างUpgrade-DistributionGroup -DlIdentities its@netway.co.th Prevent Users from Changing Photo in OWA Get-OWAMailboxPolicy | Set-OWAMailboxPolicy -SetPhotoEnabled $False Remove User Photo Remove-UserPhoto- "user name" Move/copy mailbox from one user to another Search-Mailbox -Identity “Old User” -TargetMailbox “Current User” -TargetFolder “Old-Mailbox” -LogLevel Full
ผู้ดูแลระบบของคุณเปิดใช้งานองค์กรของคุณและบัญชีของคุณด้วยการรับรองความถูกต้องแบบหลายปัจจัย (MFA) คุณต้องตั้งค่าบัญชีผู้ใช้ของคุณเพื่อใช้งานเพื่อความปลอดภัยสำหรับผู้เมื่อตั้งค่า MFA คุณจะเพิ่มความปลอดภัยอีกชั้นให้กับการลงชื่อเข้าใช้บัญชี Microsoft 365 ของคุณ ตัวอย่างเช่นคุณต้องระบุรหัสผ่านของคุณก่อนและเมื่อได้รับแจ้งคุณยังพิมพ์รหัสยืนยันที่สร้างขึ้นแบบไดนามิกจากแอปตรวจสอบสิทธิ์หรือส่งไปยังโทรศัพท์ของคุณ1. คุณจะต้องมีสิทธิ์ Global Administrator บน Office 365 ของคุณ 2. เข้าใช้งานไปที่ 3. ที่เมนูด้านซ้ายมือ ไปที่ Users > Active users 4. เลือก More > Multifactor Authentication setup (หากคุณไม่เห็นเมนูนี้ แสดงว่าคุณไม่ใช่สิทธิ์ Global Admin) 5. เมื่อเข้าสู่ multi-factor authenticaion แล้วให้เลือก User ที่ต้องการเปิดการใช้งาน หลังจากนั้นเลือก Enable ด้านขวามือ และเลือก enable multi-facctor auth 6. ขั้นตอนดังกล่าว เสร็จสิ้นในฝั่งของ Admin หลังจากนี้เมื่อ User เข้าใช้งานครั้งต่อไป ระบบจะให้ตั้งค่า 2-Step Authentication ในฝั่งของ User เป็นลำดับต่อไป ตามคู่มือด้านล่างนี้ วิธีการตั้งค่า Multi-factor authentication สำหรับผู้ใช้งาน (2-Step Authentication)รับชม Video > > _____________________________________________________________________________________________ Netway Communication ให้บริการด้าน Cloud และ IT พื้นฐานสำหรับธุรกิจ เป็นตัวแทนแบรนด์ไอทีชั้นนำมากมาย ทั้ง Microsoft, Office 365, Google Workspace, Zendesk, SSL เรามีเจ้าหน้าที่พร้อมดูแลคุณ 24 ชม. ติดต่อเราเพื่อสอบถามผลิตภัณฑ์ ขอราคา หรือปรึกษาเรื่องไอที ได้เลยค่ะ Line : @netway (มี @ ด้านหน้า) หรือhttps://bit.ly/line-netwayFacebook : m.me/netway.offcialTel : 02-055-1095Email : support@netway.co.thWeb Chat : [[URL]]/ #ให้เราช่วยคุณเรื่องไอที #การสื่อสาร Netway #มีครบจบที่เดียว #Office365 #Microsoft #Netway Communication
ช่วงนี้ทีมงานขยัน จึงมีเนื้อหาแนวสรุปมาให้ลูกค้าได้อ้างอิงเป็น reference กันเยอะหน่อยนะคะ หาก IT admin หรือ ผู้ที่สนใจเรื่อง Office 2019 เราขอรวมไว้ที่เดียวที่นี่เลยค่ะ รายละเอียดด้าน Licensing ของ Office 2019 และ Office 365 (Click >) คู่มือการเข้าถึง Volume Licensing Service Center (VLSC) เพื่อเรียกดู product keys (Click) ภาพรวมทั้งหมดเกี่ยวกับ Office 2019 สำหรับ IT Admin (Click >) คู่มือการติดตั้ง Office 2019 for Mac (Click >) ความต้องการของระบบ (System Requirement) สำหรับ Office 2019 (Click >) รวมฟีเจอร์ใหม่ของทุกแอพใน Office 2019 (Click >) การถอนการติดตั้ง Office รุ่นเก่าก่อนติดตั้ง Office 2019 (Click >) การเลือกระหว่าง 32 bit / 64 bit (Click >) ขั้นตอนการติดตั้ง Office 2019 (Click >) การตั้งค่าการอัพเดทของ Office 2019 (Click >) การ Activate Keys ของ Office 2019 (Click >) Configure a KMS host computer Configure DNS for KMS Activate by using KMS Activate by using MAK Activate by using Active Directory Rearm Office in an image Tools to manage volume activation Troubleshoot volume activation หากต้องการข้อมูลเพิ่มเติมเกี่ยวกับ Office 2019 สามารถติดต่อเข้ามาคุยได้ 24 ชม. นะคะ ที่ 02-055-1095 หรือ support@netway.co.th ค่ะ
การจัดการ Email บน Microsoft 365 ผ่าน PowerShell จำเป็นต้องเชื่อมต่อโดยเฉพาะ ซึ่งโดยทั่วไปจะเอาไว้ตั้งค่า Email ต่างๆ ที่ไม่สามารถจัดการผ่าน Exchange Admin Center ได้ ยกตัวอย่างเช่น การเปลี่ยนชื่อ Email ที่มักจะเป็นช่องสีเทา ไม่ให้จัดการผ่าน GUI นั่นเอง วิธีการ 1. ผู้ดูแลระบบ จำเป็นจะต้องติดตั้ง PowerShell บนเครื่องก่อน สามารถดูวิธีการได้ที่ Link 2. พิมพ์คำสั่งต่อไปนี้ $UserCredential = Get-Credentialจากนั้นใส่ Username และ Password ที่เป็นฝั่ง Global Admin $Session - New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office356.com/powershell-liveid -Credential $UserCredential -Authentication Basic -AllowRedirection Connect-MsolService -Credential $UserCredential Import-PSSession $Session หากท่านสามารถทำตามขั้นตอน โดยไม่มี Error เกิดขึ้น แสดงว่าสามารถเชื่อมต่อกับระบบ Exchange Online ได้เรียบร้อยแล้วนั่นเอง
สำหรับระบบ Microsoft 365 มักมีคำถามจากผู้ใช้งานหลายๆ ท่านว่า หากมีใช้งาน Active Directory ที่เป็นของบริษัทตัวเองอยู่แล้ว เมื่อใช้งาน Microsoft 365 จะสามารถเชื่อมต่อเพื่อให้ใช้ Username และ Password เดียวกันได้หรือไม่ เพื่อจะช่วยให้ไม่ต้องจัดการผู้ใช้งานหลายที่นั่นเอง ดังนั้น ในคู่มือนี้ จะสาธิตวิธีการเชื่อมต่อ AD Connect จาก Microsoft 365 (Azure AD) กับ AD On-premise แบบ Express Setting โดยมีวิธี ดังนี้ครับ ก่อนอื่นตรวจสอบ System Requirement กันก่อน ว่าต้องมีอะไรบ้าง 1. การตั้งค่าส่วนนี้จะเป็นแบบ Express Setting ดังนั้นค่า Attribute ที่ระบบจะ Sync ไปยัง Azure AD บน Office365 คือค่า UPN (User Principal Name) ซึ่งแน่นอนว่า Domain ที่ใช้งานในค่าดังกล่าวต้องเป็น Domain เดียวกันกับที่มีบน Office365 ซึ่งหากไม่มี ลูกค้าสามารถใช้วิธีการเพิ่ม Domain Suffix เพื่อให้สามารถเปลี่ยนแปลง UPN เป็น Domain ที่ต้องการได้ อย่างเช่น แต่เดิมเป็น user@netway.local จะใช้งานเป็น user@netway.co.th เป็นต้น คู่มือสำหรับการเพิ่ม Domain Suffixhttps://docs.microsoft.com/en-us/office365/enterprise/prepare-a-non-routable-domain-for-directory-synchronization 2. Download IdFix เพื่อตรวจสอบว่ามีข้อมูลซ้ำซ้อนใดๆ บน AD On-premise หรือไม่ 3. Verify domain ที่จะเชื่อมต่อบน Microsoft 365 Admin สามารถดูวิธีการได้ที่ Linkสิ้นสุดขั้นตอนเพียงแค่ Verify domain เท่านั้น 4. ตัวติดตั้งโปรแกรม ต้องติดตั้งบน Windows Server 2008 ขึ้นไป4.1. ต้องติดตั้งบน Windows Server GUI เท่านั้น4.2. หากติดตั้งบน Windows Server 2008 หรือ 2008 R2 จำเป็นจะต้อง Update windows ให้ล่าสุด4.3. Azure AD Connect จะไม่สามารถติดตั้งได้บน Small Business Server หรือ Windows Server Essentials จะต้องเป็น Windows Server standard หรือสูงกว่า4.4. หากคุณต้องการใช้ Feature password synchroniztion คุณจำเป็นจะต้องติดตั้งบน Windows Server 2008 R2 SP1 หรือสูงกว่า 5. บนเครื่องที่จะติดตั้ง ต้องลงโปรแกรม .NET Framework 4.5.1 หรือสูงกว่า 6. บนเครื่องที่จะติดตั้ง ต้องลงโปรแกรม Microsoft PowerShell 3.0 หรือสูงกว่า 7. คุณต้องมี Account administrator ของทั้งฝั่ง AD On-premise และ Microsoft 365 8. Windows Server ที่จะติดตั้งต้องสามารถใช้งาน Internet ได้ 9. Spec hardware requirement สำหรับ Azure AD Connect จำนวน Object ใน Active Directory CPU Memory Hard drive size น้อยกว่า 10,000 1.6 GHz 4 GB 70 GB 10,000 - 50,000 1.6 GHz 4 GB 70 GB 50,000 - 100,000 1.6 GHz 16 GB 100 GB สำหรับ 100,000 object ต้องการ SQL server แบบ Full version 100,000 - 300,000 1.6 GHz 32 GB 300 GB 300,000 - 600,000 1.6 GHz 32 GB 450 GB มากกว่า 600,000 1.6 GHz 32 GB 500 GB เมื่อเตรียมความพร้อมของ Server เรียบร้อยแล้ว สามารถ Download Azure AD Connect ได้ที่ Link ขั้นตอนการติดตั้ง 1. เปิดโปรแกรม AzureADConnect.msi ที่ได้ Download ไว้ 2. ในหน้า Welcome Screen เลือกยอมรับ Licensing terms และเลือก Continue 3. ในหน้า Express settings เลือก Use express settings 4. ในหน้า Connect to Azure AD ให้ใส่ Username และ Password ที่มีสิทธิ์ Global Administrator ที่อยู่บน Microsoft 365 5. ในหน้า Connect to AD DS ให้ใส่ Username และ Password ที่มีสิทธิ์ Administrator ที่อยู่บน Active Directory On-premise 6. จะเข้าสู่หน้าต่าง Azure AD sign-in configuration เพื่อแสดงว่า Domain ใดบ้างจะถูกเชื่อมต่อ ตรวจสอบข้อมูลเรียบร้อยแล้ว กด Next 7. เมื่อเข้าสู่หน้า Ready to configure ตรวจทานข้อมูล หากถูกต้องกด Install เมื่อดำเนินการเสร็จสิ้น กด Exit หลังจากนั้น ระบบจะทำการเชื่อมต่อ ในขั้นตอนนี้ สามารถใช้ Username และ Password เข้าใช้งานผ่าน Microsoft 365 ได้เลย หากมีคำถามเพิ่มเติม สามารถส่ง Email เข้ามาได้ที่ support@netway.co.th อีกครั้ง