Bonjour,

J'ai un problème avec un script de création de compte AD. Le compte AD se crée bien, mais lors de la connection au compte AD le home du compte remonte en "Z:" alors que le paramètre le crée en "Y:"

Code powershell : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
New-ADUser -Name $displayname -Path $path -AccountExpirationDate $accountExpirationDate -AccountPassword (Convertto-SecureString $pwd -Asplaintext -Force) `
	-ChangePasswordAtLogon $True -City $city -Company $company -Country $country -Department $department -Description $description -Displayname $displayname `
	-Emailaddress $emailaddress -Enabled $True -Givenname $givenname -Homedirectory $homedirectory -Homedrive "Y" `
	-Initials $initials -Manager $managerSam -Organization $organisation -Profilepath $profilepath -Samaccountname $login `
	-Scriptpath $scriptpath -Streetaddress $streetaddress -Surname $surname -UserPrincipalName $upn -Title $job

Code powershell : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
#creation du home
    if(-not(Test-Path $homedirectory)){md $homedirectory}
    $acl = Get-Acl -Path $homedirectory
    $permission = "chemin\$($login)", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow"
    $accessRule = new-object System.Security.AccessControl.FileSystemAccessRule $permission
    $acl.SetAccessRule($accessRule)
    $acl | Set-Acl -path $homedirectory

Merci pour l'aide.