i know this is powershell forum mainly, but since i havent received much help elsewhere (https://stackoverflow.com/questions/55112876/why-is-remove-from-role-members-not-working)
i wont lose anything by posting here as lost shot at this.
also the code is pretty much powershell so why not although i can understand if people cant help with this since its also SSAS
For some reason, the Remove() is not working properly. I keep reconnecting the server and checking if the ID gets removed and its not!
$ssasInstance = "<ssas instance name>" $accountName= "<domain\user>" Import-Module SqlServer [Microsoft.AnalysisServices.Server]$SSASserver = New-Object ([Microsoft.AnalysisServices.Server]) $SSASserver.Connect($ssasInstance) $role= $SSASserver.Roles["Administrators"] $role.Members.Remove($accountName) $role.Update()
there is no errors or anything. i did a conditional statement to check if ID exists, and if it does, remove and output removed!
i do get output
removed ID!but the ID is not really getting removed!
I have tried ADD, so that i know nothing is wrong with the script, and add works! only remove for some reason is not working…
on technet, Zoe misunderstood my post and thought i am referring to database members/roles. i am referring to server level administrators
i am using the code from here,
but this is for Adding users. Adding works just fine as i had mentioned, so i simply found that there is also remove(), and instead of add made the code remove. but i check the server and it still doesnt get removed. is the method bugged?