在 基本行動性和安全性 中管理裝置存取設定
如果您使用基本行動性和安全性,可能有些裝置無法使用基本行動性和安全性進行管理。 如果是,您應該針對基本行動性和安全性不支援的行動裝置,封鎖Exchange ActiveSync應用程式存取 Microsoft 365 電子郵件。 這有助於保護組織在更多裝置上的資訊。
採取以下步驟:
使用您的全域系統管理員帳戶登入 Microsoft 365。
在瀏覽器中,輸入: https://compliance.microsoft.com/basicmobilityandsecurity 。
移至 [組織設定] 索引 標籤。
針對 不支援的 MDM 裝置選取 [存取限制 ],並確定已選取 [ ) 需要允許存取 (裝置註冊 ]。
若要瞭解基本行動性和安全性支援哪些裝置,請參閱基本行動性和安全性的功能。
取得受控裝置基本行動性和安全性詳細資料
此外,您可以使用 Azure AD PowerShell 來取得您為基本行動性和安全性設定之組織中裝置的詳細資料。
以下是可供您使用的裝置詳細資料明細。
詳細資料 | PowerShell 中要尋找的內容 |
---|---|
裝置已在基本行動性和安全性中註冊。 如需詳細資訊,請參閱使用 基本行動性和安全性 註冊行動裝置 | isManaged參數的值為: True= 裝置已註冊。 False= 裝置未註冊。 |
裝置符合您的裝置安全性原則。 如需詳細資訊,請 參閱建立裝置安全性原則 | isCompliant參數的值為: True = 裝置符合原則規範。 False = 裝置不符合原則規範。 |
注意事項
後續的命令和腳本也會傳回Microsoft Intune所管理之任何裝置的詳細資料。
以下是執行下列命令和腳本時,您需要設定的一些事項:
步驟 1:下載並安裝適用于 Windows PowerShell 的 Azure Active Directory 模組
如需這些步驟的詳細資訊,請 參閱使用 PowerShell 連線到 Microsoft 365。
移至 適用于 IT 專業人員的 Microsoft Online Services Sign-In小幫手 RTWl ,然後選 取 [下載 Microsoft Online Services 登入小幫手]。
以下列步驟安裝適用於 Windows PowerShell 的 Microsoft Azure Active Directory 模組:
開啟管理員層級的 PowerShell 命令提示字元。
執行
Install-Module MSOnline
命令。如果系統提示您安裝 NuGet 提供者,請輸入 Y,然後按 ENTER 鍵。
如果系統提示您從 PSGallery 安裝模組,請輸入 Y,然後按 ENTER 鍵。
安裝完成後,請關閉 PowerShell 命令視窗。
步驟 2:連線到您的 Microsoft 365 訂閱
在適用于 Windows PowerShell 的 Windows Azure Active Directory 模組中,執行下列命令。
$UserCredential = Get-Credential
在 [Windows PowerShell 認證要求] 對話方塊中,輸入 Microsoft 365 全域系統管理員帳戶的使用者名稱和密碼,然後選取 [確定]。
執行下列指令:
Connect-MsolService -Credential $UserCredential
步驟 3:確定您能夠執行 PowerShell 腳本
注意事項
如果您已設定執行 PowerShell 腳本,則可以略過此步驟。
若要執行Get-MsolUserDeviceComplianceStatus.ps1腳本,您必須啟用 PowerShell 腳本的執行。
從您的 Windows 桌面選取 [開始],然後輸入 Windows PowerShell] 。 以滑鼠右鍵按一下 [Windows PowerShell],然後選取 [以系統管理員身分執行]。
執行下列指令:
Set-ExecutionPolicy RemoteSigned
出現提示時,輸入 Y,然後按 Enter。
執行 Get-MsolDevice Cmdlet 以顯示組織中所有裝置的詳細資料
開啟適用於 Windows PowerShell 的 Microsoft Azure Active Directory 模組。
執行下列指令:
Get-MsolDevice -All -ReturnRegisteredOwners | Where-Object {$_.RegisteredOwners.Count -gt 0}
如需詳細範例,請參閱 Get-MsolDevice。
執行腳本以取得裝置詳細資料
首先,將腳本儲存到您的電腦。
將下列文字複製並貼到記事本中。
param ( [PSObject[]]$users = @(), [Switch]$export, [String]$exportFileName = "UserDeviceComplianceStatus_" + (Get-Date -Format "yyMMdd_HHMMss") + ".csv", [String]$exportPath = [Environment]::GetFolderPath("Desktop") ) [System.Collections.IDictionary]$script:schema = @{ DeviceId = '' DeviceOSType = '' DeviceOSVersion = '' DeviceTrustLevel = '' DisplayName = '' IsCompliant = '' IsManaged = '' ApproximateLastLogonTimestamp = '' DeviceObjectId = '' RegisteredOwnerUpn = '' RegisteredOwnerObjectId = '' RegisteredOwnerDisplayName = '' } function createResultObject { [PSObject]$resultObject = New-Object -TypeName PSObject -Property $script:schema return $resultObject } If ($users.Count -eq 0) { $users = Get-MsolUser } [PSObject[]]$result = foreach ($u in $users) { [PSObject]$devices = get-msoldevice -RegisteredOwnerUpn $u.UserPrincipalName foreach ($d in $devices) { [PSObject]$deviceResult = createResultObject $deviceResult.DeviceId = $d.DeviceId $deviceResult.DeviceOSType = $d.DeviceOSType $deviceResult.DeviceOSVersion = $d.DeviceOSVersion $deviceResult.DeviceTrustLevel = $d.DeviceTrustLevel $deviceResult.DisplayName = $d.DisplayName $deviceResult.IsCompliant = $d.GraphDeviceObject.IsCompliant $deviceResult.IsManaged = $d.GraphDeviceObject.IsManaged $deviceResult.DeviceObjectId = $d.ObjectId $deviceResult.RegisteredOwnerUpn = $u.UserPrincipalName $deviceResult.RegisteredOwnerObjectId = $u.ObjectId $deviceResult.RegisteredOwnerDisplayName = $u.DisplayName $deviceResult.ApproximateLastLogonTimestamp = $d.ApproximateLastLogonTimestamp $deviceResult } } If ($export) { $result | Export-Csv -path ($exportPath + "\" + $exportFileName) -NoTypeInformation } Else { $result }
使用副檔名.ps1將它儲存為Windows PowerShell腳本檔案;例如,Get-MsolUserDeviceComplianceStatus.ps1。
執行腳本以取得單一使用者帳戶的裝置資訊
開啟適用於 Windows PowerShell 的 Microsoft Azure Active Directory 模組。
移至您儲存腳本的資料夾。 例如,如果您將它儲存至 C:\PS-Scripts,請執行下列命令。
cd C:\PS-Scripts
執行下列命令,以識別您想要取得裝置詳細資料的使用者。 此範例會取得 的詳細資料 bar@example.com 。
$u = Get-MsolUser -UserPrincipalName bar@example.com
執行下列命令來起始腳本。
.\Get-MsolUserDeviceComplianceStatus.ps1 -User $u -Export
此資訊會以 CSV 檔案匯出至您的 Windows Desktop。 您可以使用其他參數來指定 CSV 的檔案名和路徑。
執行腳本以取得一組使用者的裝置資訊
開啟適用於 Windows PowerShell 的 Microsoft Azure Active Directory 模組。
移至您儲存腳本的資料夾。 例如,如果您將它儲存至 C:\PS-Scripts,請執行下列命令。
cd C:\PS-Scripts
執行下列命令來識別您想要取得裝置詳細資料的群組。 此範例會取得 FinanceStaff 群組中使用者的詳細資料。
$u = Get-MsolGroupMember -SearchString "FinanceStaff" | % { Get-MsolUser -ObjectId $_.ObjectId }
執行下列命令來起始腳本。
.\Get-MsolUserDeviceComplianceStatus.ps1 -User $u -Export
此資訊會以 CSV 檔案匯出至您的 Windows Desktop。 您可以使用其他參數來指定 CSV 的檔案名和路徑。