Skip to content

Instantly share code, notes, and snippets.

@espoelstra
Created August 7, 2018 20:37
Show Gist options
  • Save espoelstra/97dad2a158f363a9f6a3bd0326e610cb to your computer and use it in GitHub Desktop.
Save espoelstra/97dad2a158f363a9f6a3bd0326e610cb to your computer and use it in GitHub Desktop.
Windows AD RFC 2307 Linux Unix LDAP attributes

Taken from https://blogs.technet.microsoft.com/activedirectoryua/2016/02/09/identity-management-for-unix-idmu-is-deprecated-in-windows-server/

  1.   Scripts (preferred method for bulk operations and automation)
    

· Using Active Directory PowerShell Cmdlet:

o Below is sample code to query/configure the various attributes

Import-Module ActiveDirectory

#To query Unix Properties of a User Object

$username = "guest"

Get-ADUser $username -Properties * | Select SamAccountName, msSFU30NisDomain,uidNumber, unixHomeDirectory, loginShell, gidnumber, @{Label='PrimaryGroupDN';Expression={(Get-ADGroup -Filter {GIDNUMBER -eq $_.gidnumber}).SamAccountName}}

#To query Unix Properties of a Group object

$groupname = "Unix Sample Group"

Get-ADGroup $groupname -Properties * | Select SamAccountName, msSFU30NisDomain,gidnumber, @{Label='Members';Expression={(Get-ADUser -Filter {GIDNUMBER -eq $_.gidnumber}).SamAccountName}}

#To query Unix Properties of a Computer Object

$computername = "server123"

Get-ADComputer $computername -Properties * | Select SamAccountName, msSFU30NisDomain,ipHostNumber, msSFU30Aliases

#Set unixHomeDirectory on a user (replace this with any of the attributes you’d like to set)

$username = "guest"

set-ADUser $username -Replace @{unixHomeDirectory="/usr/sbin/guest"}

o Below, is sample output from the sample code above

Sample output from the PowerShell Script:

SamAccountName : Guest

msSFU30NisDomain : woodgrove

uidNumber : 10001

unixHomeDirectory : /usr/sbin/guest

loginShell : /bin/sh

gidnumber : 10001

PrimaryGroupDN : Unix Sample Group

SamAccountName : Unix Sample Group

msSFU30NisDomain : woodgrove

gidnumber : 10001

Members : {Administrator, Guest}

SamAccountName : Server123

msSFU30NisDomain : woodgrove

ipHostNumber : {10.2.2.2}

msSFU30Aliases : {bla, unixtestclient}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment