Powershell script revoked ability of users to query server?

  • So I had a knucklehead run a power shell script on the sql server trying to fix the user profile service in share point. What happened is that any database owned by the a account lost all privledges to query the server. They could still log in but know body could query it. The only thing that was done to the sql server was that the following power shell script was run on it. Cause I don't know exactly what all this thing is doing I need hel deciphering it to understand what its doing. I get the add-in of powershell, I get the variables being called, but where would this thing mess up the sa account???

    Add-PSSnapin Microsoft.SharePoint.Powershell

    # these will only work if there is one DB and one SA on the box.

    # If more than one, then use Get-SPDatabase and Get-SPServiceApplication

    # to grab the GUID and pass that in instead of the pipebind

    $syncDBType = "Microsoft.Office.Server.Administration.SynchronizationDatabase"

    $upaSAType = "User Profile Service Application"

    $syncDB = Get-SPDatabase | where-object {$_.Type -eq $syncDBType}

    $upa = Get-SPServiceApplication | where-object {$_.TypeName -eq $upaSAType}

    $syncDB.Unprovision()

    $syncDB.Status = "Offline"

    $upa.ResetSynchronizationMachine()$upa.ResetSynchronizationDatabase()

    $syncDB.Provision()

    # we MUST restart the timer service for the state to be reflected in # Services on Server and Manage UPA restart-service SPTimerV4

    # at this stage we MUST add the Farm account to the SyncDB (the above # steps remove the user) remember the default schema must be 'dbo'. # If we don't do this, UPS provisioning will fail.

  • $syncDB.Status = "Offline"

    I am not familiar with these commandlets/classes but it would seem logical that it set the database offline. I do not know if the Provision method would be expected to bring it back online.

    A quick search found some articles that might help:

    https://www.mssqltips.com/sqlservertip/2608/managing-sharepoint-content-databases-with-powershell/

    https://technet.microsoft.com/en-us/library/ee906544.aspx

    https://technet.microsoft.com/en-us/library/ff607889.aspx

  • HI,

    Ya its really weird as the sync DB database was online but in the scripts processing it cut out he ability of all databases to query themselves from any user account. Basically any database that SA owned was no longer queryable. Restarting the SQL services and then the web server seemed to fix problem, but what in script cause problem, cause I see that they tried to get to the guid and not sa account.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply