Wie kann ich einen Computer in Azure AD in eine neue OU verschieben? Ich habe dieses Script
# Verbindung zu Azure AD
Connect-AzureAD
# Source und Destination OU
$sourceOU = "OU=Users,DC=contoso,DC=com"
$destinationOU = "OU=NewUsers,DC=contoso,DC=com"
$userUPN = "user1@contoso.com"
try {
$user = Get-AzureADUser -ObjectId $userUPN
if ($user) {
$user | Move-AzureADObject -TargetPath $destinationOU
Write-Host "User '$($user.UserPrincipalName)' has been moved from '$sourceOU' to '$destinationOU'."
} else {
Write-Host "User '$userUPN' not found"
}
} catch {
Write-Host "Error: $_"
}
aber was nehme ich als UPN?