This post will show you how to update the Unix Properties (LoginSehll in this example) in AD object using PowerShell.
If you don`t see the UNIX Attributes tab in the AD Object Properties, you can install Identity Management for UNIX Components.
As you can see in the screenshot above, I would like to change the Login Shell to /bin/bash.
Here is the script.
<# .Synopsis Set UNIX attributes LoginShell in AD object .DESCRIPTION Set UNIX attributes in AD object .EXAMPLE PS C:\> Set-ADLoginShell -searchBase "OU=FacStaff,OU=Campus,DC=mike,dc=com" -value "/bin/bash" #> function Set-ADLoginShell { [CmdletBinding()] [Alias()] [OutputType([int])] Param ( # Set LoginShell value [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)] [string]$value, # OU searchbase [string]$searchBase ) Begin { } Process { Get-ADUser -Filter * -SearchBase $searchBase -Properties loginshell | Set-ADUser -Replace @{loginshell=$value} -Verbose } End { } }
In line 31, the loginshell can be replaced by any attributes such as NIS Domain, UID Home Directory or GID.
You can run this cmdlet with -searchBase and -value parameters. $SearchBase is for the Organization Unit, and $value is the value in login shell attribute.
The result is reflected in the AD Object properties.