Elencare le Organization Unit presenti nello User Profile
Tramite il seguente script PowerShell è possibile elencare le Organization Unit (OU) impostate nello User Profile di SharePoint:
da un risultato simile a questo
Se compare questo errore significa che non hai i privilegi per accedere:
New-Object : Exception calling ".ctor" with "1" argument(s):
"UserProfileApplicationNotAvailableException_Logging ::
UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does
not have f3b47602-fcd1-4794-9473-c14b05b85e3c"
At line:1 char:14
+ $ConfigMgr = New-Object
Microsoft.Office.Server.UserProfiles.UserProfileConfigMa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
prova ad eseguire lo script con l'utente di farm.
PowerShell
#imposta il nome corretto della tua service application
$upsName = 'User Profile Service Application'
$ups = @(Get-SPServiceApplication | Where-Object {$_.TypeName -eq $upsName})[0]
$ctx = [Microsoft.SharePoint.SPServiceContext]::GetContext($ups.ServiceApplicationProxyGroup,[Microsoft.SharePoint.SPSiteSubscriptionIdentifier]::Default)
$config = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($ctx)
$AD = $config.ConnectionManager
$AD | Select -ExpandProperty NamingContexts | Select -ExpandProperty ContainersIncluded
Text
CN=Partitions,CN=Configuration,DC=u1,DC=sgart,DC=local
OU=Applications,OU=principale,DC=u1,DC=sgart,DC=local
OU=User,OU=Applications,OU=principale,DC=u1,DC=sgart,DC=local
Esiste anche la proprietà ContainersExcluded
Se compare questo errore significa che non hai i privilegi per accedere:
New-Object : Exception calling ".ctor" with "1" argument(s):
"UserProfileApplicationNotAvailableException_Logging ::
UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does
not have f3b47602-fcd1-4794-9473-c14b05b85e3c"
At line:1 char:14
+ $ConfigMgr = New-Object
Microsoft.Office.Server.UserProfiles.UserProfileConfigMa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand