Error when running PS script

Oct 11, 2012 at 7:49 PM
Edited Oct 18, 2012 at 3:09 PM

I keep getting the same error when running the script stating the parameter -Connection is null

 

-----ERROR------------

Get-FilterSetCondition : Cannot bind argument to parameter 'Connection' because
 it is null.
At line:1 char:53
+ $userCondition1 = Get-FilterSetCondition -Connection <<<<  $connection -Condi
tionType "user" -Attribute "UID" -Operator "Equals" -Value "@"
    + CategoryInfo          : InvalidData: (:) [Get-FilterSetCondition], Param
   eterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,V
   NTG.UserProfileFilters.PowerShell.GetFilterSetCondition

--------END ERROR--------

My variables are defined correctly.

$serviceAppName = "UserProfile_ServiceApplication"
$connectionName = "MDS_LDAP"

$profileApp = Get-SPServiceApplication | ? {$_.DisplayName -eq "UserProfile_ServiceApplication"}
$profileContext = [Microsoft.SharePoint.SPServiceContext]::GetContext(
          $profileApp.ServiceApplicationProxyGroup,
          [Microsoft.SharePoint.SPSiteSubscriptionIdentifier]::Default)
          
# Get a new UserProfileConfigManager
$configManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($profileContext)

# Get the connection called "MDS_LDAP" in the service application
$connection = $configManager.ConnectionManager | ? {$_.DisplayName -eq $connectionName}

 

Any clue as to why it is not seeing the connection variable?

 So after further checking this seems to be an authentication issue with LDAP.  AD works fine