-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue running invoke-pronounsync.psq #6
Comments
Looks like a permission issue. Do you have access to the SharePoint tenant admin? See https://pnp.github.io/powershell/cmdlets/Get-PnPUserProfileProperty.html |
Hi Merill, |
In the same boat here. Same error, same global/SP admin permissions. |
So I was getting the issue that @MschnyderISDSI and @curthendzell-lbbs. I was able to get past that after running the But now when it runs and catches someone who updated their Pronoun
|
So, I've tried to run the Invoke-pronunsync powershell, but it's still coming back Get-PnPUserProfileProperty : Attempted to perform an unauthorized operation. |
Are you connecting to the nnnnn-admin.sharepoint.com site when calling Connect-PnPOnline? |
Yes, and it connects fine |
Does this happen with all users or just some? BTW Are your users synced from on-prem AD or are these cloud users? |
Hi, this happens with all users, and they are sync’d from on-prem.
|
Ah, got it. So the script to update the extension attribute in Azure AD will only work for cloud users. If your users are synced from on-prem you will need to tweak the script to make it update Active Directory. Set-ADUser –Identity $ThisUser -add @{"extensionattribute1"="MyString"} |
Hi, Sorry, to ask a silly question, but where abouts in the invoke script does this need adding? Cheers |
You can comment out lines 54-59 (which updates AAD) and instead use the Set-ADUser. |
Hi,
Sorry I’m being a pain now. I’ve tried to change the code but it still wasn’t running correctly, hence the attached file.
Just wondering, if you could take a look, and advise where I’m going wrong.
Thanks
Jeremy Brooks
[Invoke-PronounSync - Copy.txt](https://github.com/merill/m365-gender-pronoun-kit/files/9072600/Invoke-PronounSync.-.Copy.txt)
|
Hi. I am also getting errors when running invoke-pronounsync. I ran Powershell ISE as Admin using on-prem domain admin account and elevated my Azure role to Global Admin. I have verified the app permissions in Azure Enterprise Apps. On initial run, I received this error for every user:
I thought that odd because a "get" operation should not be trying to write anything, but following advise in the above thread I ran connect-pnponline -interactive. I am now getting the above error for every user, and for some users I am also getting:
My users are on-prem and sync'd to Azure, so I tried adjusting the script as indicated above. However, I'm getting the same result. Any help or direction on this would be much appreciated! |
@merill still getting issues trying to get this to work, with the lines commented out, I get this:
The string is missing the terminator: ".
Missing closing '}' in statement block or type definition.
Missing while or until keyword in do loop. |
This is excellent @CabbageandBean. Thanks a lot for sharing! Would you like to submit a PR to add this script to the repository? |
Hi @CabbageandBean I've tested your script, and it's running through my directory without an issue, though I'm sure I tried what you've done, and couldn't get it to run, one thing I've noticed, is that it's not updating accounts, if there is an entry in the cloud, wonder if anyone has any thoughts? |
What Version of windows server are you running? Also please replace "-add" with "-replace" on line 54. No errors when running it no? Have your users set their pronouns via the Sharepoint contact card? |
@CabbageandBean running on a Win 22 Server, running as a DC. Even with the replace, it just scrolls through, it's like it's not reading the Pronoun field, that was setup through Sharepoint / Delve. |
When it runs through, it just shows checking, when it gets to my account, which I've amended the Pronoun in the cloud, it just shows checking |
So it appears that it isn't getting past the Write Host - Checking part of the script. Log into PNP powershell manually and see if you can run Get-PnPUserProfileProperty -Account "your email" and make sure it retuns the correct value without error |
I've found out what the issue was, when I'd created the field to alter in Sharepoint, I'd called it UserPronoun, so it couldn't pick up the field, I removed that field, and re-created it calling it Pronoun and updated the field on Sharepoint and when I ran the script it worked and updated my Account. Thanks for the pointers. |
G'day, @CabbageandBean - I am wondering if you could please help me out with this? I am trying to run your script however it's not working. Set-ADUser : replace
Thanks |
Hi, can someone assist on this issue? Thanks |
What account are you running the script as?? |
@jjmbrooks80RM - Hi, I am running the script as administrator in PS ISE mode. Error while updating pronoun - |
Hi, just following up if anyone can assist? Thanks |
I ran it using an account with Domain Admin, rather then administrator |
Sorry, i did run with domain admin still same error. |
Hi, anyone who can assist on this issue? Thanks |
@ranchopra This is most probably a permission issue. Have you tried running the Set-ADUser directly (without the script) to verify that your account has the right permission to perform the update? |
Hello,
I've run everything up to the invoke script. The pronoun field shows up in SharePoint custom properties, I confirmed the app and API permissions were set.
When I run the script I get the below error for every user. Can anyone help?
Get-PnPUserProfileProperty : Attempted to perform an unauthorized operation.
At E:\Invoke-PronounSync.ps1:48 char:20
Thanks
The text was updated successfully, but these errors were encountered: