Guys,
I would like to know what should i use to add a manager to a user in AD i have the below script that working just fine, i just want to add the manger filed as well.
#Import ActiveDirectory module
Import-Module ActiveDirectory
#Input New User Parameters Here
$Password = ConvertTo-SecureString -string 'password go here' -asPlainText -Force
$OU = 'domain.com/domain/Users'
$first = 'test'
$last = 'test1'
$al = 'test1'
$title = 'Corporate Systems Engineer'
$dep = 'Sales - Engineering'
#Do Not Change
$displayname = $first + ' ' + $last
$UPN = $al+'@domain.com'
$SAM = $al
#Create New Exchange User
New-Mailbox -Name $displayname -Alias $al -OrganizationalUnit $OU -UserPrincipalName $UPN -SamAccountName $SAM -FirstName $first -Initials '' -LastName $last -Password $Password -ResetPasswordOnNextLogon $false
Set-ADUser $al -Title $title -Department $dep
Add-ADGroupMember -Identity group name -Members $al
Set-ADUser $al -Replace @{showInOrgChart=$true}
Set-ADUser $al -Office 'France Office' -Company domain.com.' -Title $title -Department $dep -Country FR -Description Employee
#Enable User for Lync
Enable-CsUser -Identity $displayname -RegistrarPool 'server address.com' -SipAddressType EmailAddress
↧