Mass modifying userWorkstations user attribute in Active Directory

Adding computers to which users can logon in Active Directory - task that administrators must perform quite ofter. Moreover, sometimes you must provide this privilege to all users in domain.

Here is the powershell script that will help you in this (it does not modify users that have rights to log on to ANY computers):

$a = Get-QADUser -Includedproperties userWorkstations | ?{$_.userWorkstations -ne $null}

foreach ($user in $a) {
	[string]$de = $user.userWorkstations
	$de += ",222"
	Set-QADUser $user -ObjectAttributes @{userWorkstations=@($de)}
}
 

Tags: active directory (ru), script, powershell (ru)

PrintEmail

Add comment


Security code
Refresh