|
|
@ -86,17 +86,22 @@ if ($state -eq 'present') {
|
|
|
|
Create-User $username $password
|
|
|
|
Create-User $username $password
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$result.changed = $true
|
|
|
|
$result.changed = $true
|
|
|
|
|
|
|
|
$user_obj = Get-User $username
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
catch {
|
|
|
|
Fail-Json $result $_.Exception.Message
|
|
|
|
Fail-Json $result $_.Exception.Message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
# Remove user
|
|
|
|
# Remove user
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Delete-User $bob
|
|
|
|
if ($user_obj.GetType) {
|
|
|
|
$result.changed = $true
|
|
|
|
Delete-User $user_obj
|
|
|
|
|
|
|
|
$result.changed = $true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
Set-Attr $result "msg" "User '$username' was not found"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
catch {
|
|
|
|
Fail-Json $result $_.Exception.Message
|
|
|
|
Fail-Json $result $_.Exception.Message
|
|
|
|