forked from dsccommunity/ActiveDirectoryDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2-ADUser_CreateUserAndIgnorePasswordChanges_Config.ps1
47 lines (43 loc) · 1.38 KB
/
2-ADUser_CreateUserAndIgnorePasswordChanges_Config.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
<#PSScriptInfo
.VERSION 1.0.1
.GUID 3bf5100b-238e-435a-8a98-67d756c5cdeb
.AUTHOR DSC Community
.COMPANYNAME DSC Community
.COPYRIGHT DSC Community contributors. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/dsccommunity/ActiveDirectoryDsc/blob/main/LICENSE
.PROJECTURI https://github.com/dsccommunity/ActiveDirectoryDsc
.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png
.RELEASENOTES
Updated author, copyright notice, and URLs.
#>
#Requires -Module ActiveDirectoryDsc
<#
.DESCRIPTION
This configuration will create a user with a password and then ignore
when the password has changed. This might be used with a traditional
user account where a managed password is not desired.
#>
Configuration ADUser_CreateUserAndIgnorePasswordChanges_Config
{
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$Password
)
Import-DscResource -Module ActiveDirectoryDsc
Node localhost
{
ADUser 'Contoso\ExampleUser'
{
Ensure = 'Present'
UserName = 'ExampleUser'
Password = $Password
PasswordNeverResets = $true
DomainName = 'contoso.com'
Path = 'CN=Users,DC=contoso,DC=com'
}
}
}