New-DfsnFolder : Access to a CIM resource was not available to the client.AtD:\scripts\IAM\sharefoldermanagement\AddingShareToDFS\AddingShareToDFS.ps1:8char:5+ $a=New-DfsnFolder -Path $path -TargetPath $share -EnableTargetFailback $true+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : PermissionDenied: (MSFT_DfsNamespaceFolder:Root\Microsoft.…NamespaceFolder) [New-DfsnFolder], CimException+ FullyQualifiedErrorId : MI RESULT 2,New-DfsnFolder
I am getting the above error when trying to execute dfsn commandlets in a ps-session of a 2012R2 server.Module dfsn and fsrm roles are enabled.When I am directly executing the script in 2012 without any session.It is working well and fine.
Remote execution policy and trusted host is enabled.
Running as administrator.It is same user given to mange the DFS in GUI.
Any help appreciated.
Thanks in advance