-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicsW5.ps1
More file actions
31 lines (29 loc) · 855 Bytes
/
DynamicsW5.ps1
File metadata and controls
31 lines (29 loc) · 855 Bytes
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
param(
[string]$action,
[string]$logname="Dynamics CRM Audit"
)
$dynamics_rules="<FieldInfo>
<EventRules>
<Field Name=""What"" CopyFrom=""Category""></Field>
<Field Name=""Where"" CopyFrom=""Computer""></Field>
<Field Name=""Who"" CopyFrom=""UserName""></Field>
<Field Name=""Whom"" Index = ""3""></Field>
</EventRules>
</FieldInfo>"
$Inenv = new-object -ComObject InTrustServiceLookup.InTrustEnvironment
$srv=$Inenv.ConnectToServer('localhost')
$org=$srv.Organization
$ev1 = $org.Eventory
switch($action)
{
List{$ev1.Logs}
Dump{$ev1.Eventory}
Add{
$ev1.Logs.Add($logname,$dynamics_rules)
}
Modify{
$log_c=$ev1.Logs.Item($logname)
$log_c.Rules=$dynamics_rules
}
default{$ev1.Logs}
}