-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathADAtributes2.ps1
23 lines (18 loc) · 954 Bytes
/
ADAtributes2.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$info = Get-ADUser -filter {(SamAccountName -like 'Kirtok*')} -property cn,SamAccountName,departmcom,company,l,streetAddress,extensionAttribute10,extensionAttribute11
# `
#| select cn,departmcom,company,l,streetAddress `
#| Export-CSV d:\ADUsersattr.csv -NoTypeInformation -Encoding UTF8
foreach ($line in $info) {
$a10=$($line.departmcom+' - '+$line.company)
$a11=$($line.l+', '+$line.streetAddress)
$line.SamAccountName
#$a10
#$a11
$line.extensionAttribute10
$line.extensionAttribute11
}
Set-ADUser –Idcomity $info.SamAccountName -Clear "extensionAttribute10"
Set-ADUser –Idcomity $info.SamAccountName -Add @{extensionAttribute10=($info.departmcom+' - '+$info.company)}
Set-ADUser –Idcomity $info.SamAccountName -Clear "extensionAttribute11"
Set-ADUser –Idcomity $info.SamAccountName -Add @{extensionAttribute11=($info.l+', '+$info.streetAddress)}
#Set-ADUser –Idcomity $info.SamAccountName -Add @{company=$fff}