Hi
I cant find information about this issue anywhere, so I shall try my luck here:-)
Using server 2012R2 with Powershell 5 and Desired State Configuration.
I have created a DSC module with dscresources (class 5) for configuring SharePoint. Meaning additional configurations in addition to the SharePointDSC module in PowerShell Gallery and github repository.
When running SharePoint cmdlets in powershell it is neccessary to add the SharePoint snapin:
if ((Get-PSSnapin -Registered -Name 'microsoft.sharepoint.powershell') -ne $null) { try { Add-PSSnapin 'microsoft.sharepoint.powershell' Write-Debug 'Added microsoft.sharepoint.powershell snapin' } catch { throw 'There was a problem loading snapin microsoft.sharepoint.powershell.' } } else { throw 'microsoft.sharepoint.powershell snapin is not installed on this system!' }
However, when running my mof (Managed Object Format) file with verbose I get the message:
PowerShell DSC resource SkaDscResourceSharePoint failed to execute Test functionality with error message: There was a problem loading snapin microsoft.sharepoint.powershell.+ CategoryInfo : InvalidOperation: (:) [], CimException+ FullyQualifiedErrorId : ProviderOperationExecutionFailure+ PSComputerName : localhost
I have tried just adding the snapin like this
add-PSSnapin microsoft.sharepoint.powershell
But that gives me the error :
An item with the same key has already been added
Any hints and tips are welcome!
brgs
Bjørn