-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enable_Hybrid_Reporting.ps1
52 lines (45 loc) · 2.57 KB
/
Enable_Hybrid_Reporting.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<#
.Written By: Dave Hodge, MCS
.Purpose: Enable the MIM Service to write all MIM Service Requests to the Identity Manager Request Log in EventViewer so that the Auditor service can import them into the Log Analytics Workspace.
.SYNOPSIS
Script to manually configure MIM 2016 Hybrid Reporting without installing the Hybrid Reporting Agent as described in
https://docs.microsoft.com/en-us/microsoft-identity-manager/working-with-identity-manager-hybrid-reporting
#>
###############################################################################
# Step 1. Get the path to the MIM Service configuration file.
###############################################################################
$ImagePath = Get-ItemPropertyValue -Path HKLM:\System\CurrentControlSet\Services\FIMService -Name ImagePath
$ImagePath = $imagepath.replace("""","") + ".config"
###############################################################################
# Step 2. Get the FIMService config file.
###############################################################################
$Config = [xml] (Get-Content $imagepath)
###############################################################################
# Step 3. Set hybridReportingRequestLoggingEnabled="true"
###############################################################################
If ($Config.configuration.resourceManagementService.hybridReportingRequestLoggingEnabled -ne $true)
{
$hybridReportingRequestLoggingEnabled = $Config.configuration.resourceManagementService.OwnerDocument.CreateAttribute("hybridReportingRequestLoggingEnabled")
$hybridReportingRequestLoggingEnabled.Value = "true"
$void = $Config.configuration.resourceManagementService.Attributes.Append($hybridReportingRequestLoggingEnabled)
$Config.Save($ImagePath)
}
Else
{
write-host "Hybrid reporting request logging is already enabled" -ForegroundColor Green
}
###############################################################################
# Step 4. Create the EventLog to store the MIM Request Events in.
###############################################################################
If ([System.Diagnostics.EventLog]::Exists('Identity Manager Request Log') -ne $true)
{
New-EventLog -LogName "Identity Manager Request Log" -Source "Microsoft.IdentityManagement.Service"
}
Else
{
Write-Host "Event log already exists!" -ForegroundColor Green
}
###############################################################################
# Step 5. Restart FIMService service
###############################################################################
Restart-Service FIMService