blob: 7d9167e6fe7c2731764026ccd1bce1cc7b831de4 (
plain)
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
|
#!powershell
# Copyright: (c) 2023, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#AnsibleRequires -CSharpUtil Ansible.Basic
#AnsibleRequires -PowerShell ..module_utils._ADObject
$setParams = @{
PropertyInfo = @(
[PSCustomObject]@{
Name = 'type'
Option = @{ type = 'str' }
Attribute = 'objectClass'
StateRequired = 'present'
New = {
param ($Module, $ADParams, $NewParams)
$NewParams.Type = $Module.Params.type
$Module.Diff.after.type = $Module.Params.type
}
Set = {
param ($Module, $ADParams, $SetParams, $ADObject)
$Module.Diff.after.type = $ADObject.ObjectClass
if ($ADObject.ObjectClass -ne $Module.Params.type) {
$msg = -join @(
"Cannot change object type $($ADObject.ObjectClass) of existing object "
"$($ADObject.DistinguishedName) to $($Module.Params.type)"
)
$Module.FailJson($msg)
}
}
}
)
}
Invoke-AnsibleADObject @setParams
|