Details of the scenario you tried and the problem that is occurring
Once I install the snmpd package on Ubuntu 22.04 it creates a user named Debian-snmp (note the uppercase D).
Following this change every use of nxUser fails even if it does not reference that user.
ForEach-Object: Cannot convert value "Debian-snmp:x:116:124::/var/lib/snmp:/bin/false" to type
"nxLocalUser". Error: "Unrecognised passwd entry:
'Debian-snmp:x:116:124::/var/lib/snmp:/bin/false'."
Verbose logs showing the problem
VERBOSE: Populating RepositorySourceLocation property for module nxtools.
VERBOSE: Loading module from path '/root/.local/share/powershell/Modules/nxtools/1.2.0/nxtools.psm1'.
VERBOSE: The Get-DscResource input 'Name' parameter value is 'nxUser'.
VERBOSE: Skipping resource 'Reason' as it does not match the requested name.
VERBOSE: Skipping resource 'nxFile' as it does not match the requested name.
VERBOSE: Skipping resource 'nxGroup' as it does not match the requested name.
VERBOSE: Creating resource 'nxUser'.
VERBOSE: Skipping resource 'nxPackage' as it does not match the requested name.
VERBOSE: Skipping resource 'nxFileLine' as it does not match the requested name.
VERBOSE: Skipping resource 'nxFileContentReplace' as it does not match the requested name.
VERBOSE: Skipping resource 'nxService' as it does not match the requested name.
VERBOSE: Skipping resource 'nxScript' as it does not match the requested name.
VERBOSE: Skipping resource 'GC_LinuxGroup' as it does not match the requested name.
VERBOSE: Skipping resource 'GC_msid110' as it does not match the requested name.
VERBOSE: Skipping resource 'GC_msid121' as it does not match the requested name.
VERBOSE: Skipping resource 'GC_msid232' as it does not match the requested name.
VERBOSE: Skipping resource 'GC_InstalledApplicationLinux' as it does not match the requested name.
VERBOSE: Skipping resource 'GC_NotInstalledApplicationLinux' as it does not match the requested name.
VERBOSE: Skipping resource 'GC_LinuxLogAnalyticsAgent' as it does not match the requested name.
ForEach-Object: Cannot convert value "Debian-snmp:x:116:124::/var/lib/snmp:/bin/false" to type
"nxLocalUser". Error: "Unrecognised passwd entry:
'Debian-snmp:x:116:124::/var/lib/snmp:/bin/false'."
Suggested solution to the issue
The regular expression used to parse passwords appears to be wrong.
It dies if there are any upper-case letters in the username.
Change source/Classes/nxLocalUser.ps1#4 through 12 to:
Details of the scenario you tried and the problem that is occurring
Once I install the
snmpd
package on Ubuntu 22.04 it creates a user namedDebian-snmp
(note the uppercase D). Following this change every use of nxUser fails even if it does not reference that user.Verbose logs showing the problem
Suggested solution to the issue
The regular expression used to parse passwords appears to be wrong. It dies if there are any upper-case letters in the username.
Change source/Classes/nxLocalUser.ps1#4 through 12 to:
Example modified regexp: https://regexr.com/7k1fr
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used