2017-11-10 3 views
1

私のコレクションの別の共有サイトにアクセスしたユーザーのリストをエクスポートしようとしています。私は試してみましたが、私はそれを内部のユーザーと一緒に使うことができますが、外部のユーザーは使用できません。Sharepointサイトを訪問したユーザーを参照してください。Search-UnifiedAuditLog

$startdate = "11/10/2017 8:00 AM" 
$enddate = "11/10/2017 9:00 AM" 
$userIDs = (import-csv C:\Junk\User.csv).Email 
foreach ($userid in $userids) { 
    $AuditlogMain = Search-UnifiedAuditLog -StartDate $startdate -EndDate $enddate -RecordType SharePoint -Operations PageViewed -UserIds $userID -ObjectIds "https://sitename.sharepoint.com/" -Formatted 
    $AuditlogMain.UserIDs | Select-object -Unique | Out-File C:\junk\Main.csv -Append 
} 
私はその後、私はまた、すべての外部ユーザーをリストにしたいと私は単に_.com#EXT番号に「@ .COM」からのメールを変更する方法を知りませんが、ユニークユーザーの一覧を取得

@ .onmicrosoft.com

サイトを訪問したユーザーをエクスポートするより簡単な方法はありますか? もしあなたが$AuditlogMain.AuditDataを見ると、私が望むいくつかのより多くの情報がありますが、それをどのように抽出するのか分かりません。だから、もし誰かが私の助けを借りて私の助けを借りることができますより好ましくはClientIP, ObjectId, UserId$AuditlogMain.AuditDataから助けてください。事前に

おかげ提供の記事から

答えて

0

抜粋:

$cred = Get-Credential 

$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection 
Import-PSSession $session 
Connect-MsolService -Credential $cred 

$extUsers = Get-MsolUser | Where-Object {$_.UserPrincipalName -like "*#EXT#*" } 

$extUsers | ForEach { 
    $auditEventsForUser = Search-UnifiedAuditLog -EndDate $((Get-Date)) -StartDate $((Get-Date).AddDays(-7)) -UserIds $_.UserPrincipalName 

    Write-Host "Events for" $_.DisplayName "created at" $_.WhenCreated 

    $auditEventsForUser | FT 
} 

Remove-PSSession $session 

ここでは、外部ユーザーの監査情報を取得する方法について説明の記事です: https://www.sharepointappie.nl/using-powershell-to-get-audit-data-for-external-users/

関連する問題