This is a PowerShell cmdlet for adding Unix attributes to a Windows Active Directory user. It is especially useful with Windows Server 2016 which removed the NIS server and the GUI tools for managing the Unix attributes.
It will automatically find and assign the next available UID.
For direct download of a Windows installer, see bottom of page.
Usage:
Add-UnixAttributes -sAMAccountName [-NISDomain] [-GIDNumber] [-LoginShell] [-UnixHomeDirectory]
Parameters:
- sAMAccountName: the username to add Unix Attributes to.
- NISDomain: the NIS Domain to use (default: int).
- GIDNumber: the primary GID to assign (default: 750)
- LoginShell: the login shell to assign (default: /bin/bash)
- UnixHomeDirectory: the home directory to set (default: /home/<sAMAccountName>)
Building
The script is already written in PowerShell, so you do not have to build it.
Usage
To import the script in your current session: `Import-Module Add-UnixAttributes.psm1`. Alternarively, run it from its directory.
You must use an Administrator shell for it to work.
You need to have PowerShell ActiveDirectory module installed (part of RSAT).
Packaging
You can use the provided NSIS script to build a GUI installer with your DLL. NSIS is available for Windows and Linux, see http://nsis.sourceforge.net (on Linux, be sure to check with your distro first):
- From the top level directoy of the repo, call makensis Add-UnixAttributes.nsis.
Binary Downloads
Download a Windows installer with the cmdlet: AddUnixAttributes.zip
Notes:
- This is a ZIP file. Extract the EXE installer from it.
- Installation must be carried by a user with Administrator privileges.
- The Windows machine must be an AD domain member with RSAT installed.
- The installation goes to a local directory. You must install the cmdlet on each machine you intend to use if (even if installing on replicated Domain Controller).
- Using the cmdlet requires Administrator privileges over the AD domain. Additionally, you must use an Administrator shell for it to work.