Quantcast
Channel: AutoSPInstaller
Viewing all articles
Browse latest Browse all 2279

Commented Issue: Account invalid (SuperReader, SuperUser) [20601]

$
0
0
If the SuperReader and SuperUser Account exist in another domain, these accounts are marked as invalid. The problem is caused by the method:

function userExists ([string]$name)

In my view this function should use a domain parameter to work properly.
Comments: ** Comment from web user: JonasEsser **

ok.. I've tested the configuration on a Windows Server 2012. Still the same issue. To solve it temporarily for me, I have overridden the ValidateCredentials method as follows:

- 1 - To ignore "invalid" accounts and proceed the installation, I have commented out the throw-

```
If ($acctInvalid) {
Write-Host -ForegroundColor Black -BackgroundColor Red "At least one set of credentials is invalid."
Write-Host -ForegroundColor Black -BackgroundColor Red "Check usernames and passwords in each place they are used."
Pause "proceed if you are sure this is OK, or Ctrl-C to exit" "y"
#Throw " - At least one set of credentials is invalid.`n - Check usernames and passwords in each place they are used."
} else
{
Pause "proceed if you are sure this is OK, or Ctrl-C to exit" "y"
}
```

- 2 - I created a copy of the UserExists function with a second parameter "LDAPPATH". If a validation fails the script asks for a ldap path to recheck the user account (see attached screenshot)

```
if (!(userExists $accountName))
{
Write-Host -BackgroundColor Red -ForegroundColor Black "Invalid!"
$LDAPPath = Read-Host "Specify a LDAP Path (e.g. DC=dev,DC=company,DC=local) to check account again or press enter continue."
if (!(userExistsLDAPPath $accountName $LDAPPath))
{
Write-Host -BackgroundColor Red -ForegroundColor Black "Invalid!"
$acctInvalid = $true
}
else
{
Write-Host -ForegroundColor Black -BackgroundColor Green "Verified."
}
}
```

```
function userExistsLDAPPath ([string]$name, [string]$LDAPPATH)
{
if($LDAPPath)
{
$LDAPPATH = "LDAP://" + $LDAPPATH
}
Write-Host "Search explicit in path:" $LDAPPATH
#written by: Øyvind Nilsen (oyvindnilsen.com)
[bool]$ret = $false #return variable
$domainRoot = [ADSI]$LDAPPATH
$dirSearcher = New-Object System.DirectoryServices.DirectorySearcher($domainRoot)
$dirSearcher.filter = "(&(objectClass=user)(sAMAccountName=$name))"
#$dirSearcher.SearchRoot = $LDAPPATH
$results = $dirSearcher.findall()
if ($results.Count -gt 0) #if a user object is found, that means the user exists.
{
$ret = $true
}
return $ret
}
```

not very user friendly but enough for me :-)


Viewing all articles
Browse latest Browse all 2279

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>