-
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}