Good afternoon everyone,
I’m looking for a script to apply permissions to folders inside Sharepoint, but I’m not even able to run tests because powershell does not run some scripts, the main error is when I execute any command like this: “$ site = new-object Microsoft.SharePoint.SPSite (” https://contoso.sharepoint.com/ “)”, Shell brings me: new-object: Can not find the type [Microsoft.SharePoint.SPSite]: Make sure the assembly containing the type is loaded.
I can’t import modules, and can’t add Snapin, when I run: “Add-PSSnapin Microsoft.SharePoint.PowerShell”, Shell brings me: Add-PSSnapin: No snap-ins were registered for Windows PowerShell version 5.
That is, I can not do anything on account of not loading some assembly modules.
Could someone give me a help regarding this please?
So, I’m sure you’ve checked, but just to be thorough - are you certain that the SharePoint snapin is installed on the computer? You’d get that by installing the SP management tooling, like its admin console, on your system. That should also be what installs the SharePoint .NET Framework bits are installed.
Yes, i’ve installed: the SharePoint Online Management Shell, the msoid.exe, Sharepoint client components (SDK), but I can’t execute the Snapin like this command: “Add-PSSnapin Microsoft.SharePoint.PowerShell”, because Shell brings me:
Add-PSSnapin: No snap-ins were registered for Windows PowerShell version 5.
That kind of makes me think the snap in isn’t registering as v5 compatible. I don’t know a ton about how SharePoint structures that - and I still can’t believe they’re using a snap in and not a module! But it’s entirely possible that it isn’t v5 compatible. I know it was originally developed for v3.