I’m very new to powershell and i have problem with a command. I’m trying to remove a link from the navigation bar of my sharepoint site using powershell. I found a site and copied the commands, but one command isn’t working, I tried searching to find a way to fix it and i found the pnp website, i read it but didn’t understand much, that’s why i came here for help.
Again … when you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
The error message is pretty obvious though. $navigationNode.Id seems to empty. And since you’re not showing how you populate this variable all we could do is taking a wild guess.
Hi,
Check what you have in $navigationNode after running the script.
If it is empty, remove | Where-Object { $_.Title -eq “Pages” } and then check, what do you have in $navigationNode. If in output you will have list of pages you should use | Where-Object { $_.Title -like “*Pages*” } to get only pages with Pages in name.
I found the solution. In the site I visited to get the script, it didn’t specify that the script only works on only team sites. My site is a communication site so I had to change the location :
I found the problem by checking the output, the output was always empty every time I executed the script so i figured that it was the wrong location. Thanks a lot!
When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.