From 1fe395ab293020ca78929b0d54c31454d78d0f50 Mon Sep 17 00:00:00 2001 From: John D Pell <52194+gaelicWizard@users.noreply.github.com> Date: Sun, 16 May 2021 22:31:01 -0400 Subject: [PATCH] Add SamAccountName property to ADUser Add SamAccountName property to allow setting the name of the user; this requires that the UserName property be specified with something other than the SamAccountName (e.g., the SID, DN, &c.). --- .../DSCResources/MSFT_ADUser/MSFT_ADUser.PropertyMap.psd1 | 6 ++++++ source/DSCResources/MSFT_ADUser/MSFT_ADUser.schema.mof | 1 + 2 files changed, 7 insertions(+) diff --git a/source/DSCResources/MSFT_ADUser/MSFT_ADUser.PropertyMap.psd1 b/source/DSCResources/MSFT_ADUser/MSFT_ADUser.PropertyMap.psd1 index b9b27d971..e5a98dea0 100644 --- a/source/DSCResources/MSFT_ADUser/MSFT_ADUser.PropertyMap.psd1 +++ b/source/DSCResources/MSFT_ADUser/MSFT_ADUser.PropertyMap.psd1 @@ -18,6 +18,12 @@ UseCmdletParameter = $false Array = $false } + @{ + Parameter = 'SamAccountName' + ADProperty = 'SamAccountName' + UseCmdletParameter = $true + Array = $false + } @{ Parameter = 'Path' ADProperty = 'distinguishedName' diff --git a/source/DSCResources/MSFT_ADUser/MSFT_ADUser.schema.mof b/source/DSCResources/MSFT_ADUser/MSFT_ADUser.schema.mof index ddb18f145..7ebb4f9f9 100644 --- a/source/DSCResources/MSFT_ADUser/MSFT_ADUser.schema.mof +++ b/source/DSCResources/MSFT_ADUser/MSFT_ADUser.schema.mof @@ -9,6 +9,7 @@ class MSFT_ADUser : OMI_BaseResource [Write, Description("Specifies the common name assigned to the user account (ldapDisplayName 'cn'). If not specified the default value will be the same value provided in parameter UserName.")] String CommonName; [Write, Description("Specifies the User Principal Name (UPN) assigned to the user account (ldapDisplayName 'userPrincipalName').")] String UserPrincipalName; [Write, Description("Specifies the display name of the object (ldapDisplayName 'displayName').")] String DisplayName; + [Write, Description("Specifies the SamAccountName of the object (ldapDisplayName 'SamAccountName').")] String SamAccountName; [Write, Description("Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created.")] String Path; [Write, Description("Specifies the user's given name (ldapDisplayName 'givenName').")] String GivenName; [Write, Description("Specifies the initials that represent part of a user's name (ldapDisplayName 'initials').")] String Initials;