Share via


New-DfsnFolder : Access to a CIM resource was not available to the client.

Question

Wednesday, November 12, 2014 1:56 PM

Hello,

I need your help because I have a problem with my PowerShell script and I didn't find any solution on Internet.

Following the error message:

New-SMBShare : The name has already been shared. 
At line:2 char:9
+         New-SMBShare -CimSession $cimSession -Name "$unit" -Path "S:\UnitData\$u ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_SMBShare:ROOT/Microsoft/Windows/SMB/MSFT_SMBShare) [New-SmbShare], CimException
    + FullyQualifiedErrorId : Windows System Error 2118,New-SmbShare
    + PSComputerName        : DEVO-FILE01
 
New-DfsnRoot : 110
At line:3 char:9
+         New-DfsnRoot -CimSession $cimSession -Type DomainV2 -TargetPath "\\$newD ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_DFSNamespace:ROOT\Microsoft\...FT_DFSNamespace) [New-DfsnRoot], CimException
    + FullyQualifiedErrorId : MI RESULT 110,New-DfsnRoot
    + PSComputerName        : DEVO-FILE01
 
New-DfsnFolder : The requested object could not be found.
At line:4 char:9
+         New-DfsnFolder -Path "\\$RootNameSpace\$unit\$site" -TargetPath "\\$newD ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_DfsNamespaceFolder:Root\Microsoft\...NamespaceFolder) [New-DfsnFolder], CimException
    + FullyQualifiedErrorId : MI RESULT 6,New-DfsnFolder

And the code that I use:

        $cimSession = New-CimSession -ComputerName $newDestServer
        New-SMBShare -CimSession $cimSession -Name "$unit" -Path "S:\UnitData\$unit"
        New-DfsnRoot -CimSession $cimSession -Type DomainV2 -TargetPath "\\$newDestServer\$unit" -Path "\\$RootNameSpace\$unit" -EnableSiteCosting $true
        New-DfsnFolder -Path "\\$RootNameSpace\$unit\$site" -TargetPath "\\$newDestServer\$unit"
        Remove-CimSession $cimSession

Have you an idea where the problem is located?

Thank you.

Regards,

Florent

All replies (4)

Thursday, November 13, 2014 9:23 AM ✅Answered

Hi Florent,

1.  For the first error "The name has already been shared":

I recommend you can use the the cmdlet "Get-SMBShare" to list all share folders firstly before creating a new share, and check if there is share named "$unit" on remote server.

2.  For the second error "The requested object could not be found":

According to your script, you want to creat a new share on remote computer, then add this share folder to the new created namespace on file server, please try the script below:

New-DfsnRoot -Type DomainV2 -TargetPath "\\$newDestServer\$unit" -Path "\\$RootNameSpace\$unit" -EnableSiteCosting $true
New-DfsnFolder -Path "\\$RootNameSpace\$unit\$site" -TargetPath "\\$newDestServer\$unit"

If there is anything else regarding this issue, please feel free to post back.

If you have any feedback on our support, please click here.

Best Regards,

Anna Wang

TechNet Community Support


Sunday, November 16, 2014 7:40 AM ✅Answered

Hi Florent,

This is my result with the cmdlet "New-DfsnRoot" and "New-Dfsnfolder", and you can find the folder in DFS Namespace Console:

If there is anything else regarding this issue, please feel free to post back.

If you have any feedback on our support, please click here.

Best Regards,

Anna Wang

TechNet Community Support


Thursday, November 13, 2014 10:34 AM

Thank you AnnaWY for your solution.

I have now another error:

New-DfsnFolder : A general error occurred that is not covered by a more specific error code.
At line:56 char:9
+         New-DfsnFolder -Path "\\$RootNameSpace\$unit\$site" -TargetPath "\\$newD ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_DfsNamespaceFolder:Root\Microsoft\...NamespaceFolder) [New-DfsnFolder], CimException
    + FullyQualifiedErrorId : MI RESULT 145,New-DfsnFolder

With this PowerShell line:

New-DfsnFolder -Path "\\$RootNameSpace\$unit\$site" -TargetPath "\\$newDestServer\$unit" -State Offline

Thanks again.

Florent


Friday, November 14, 2014 12:09 PM

Hello,

I have this error too:

Access to a CIM resource was not available to the client.
    + CategoryInfo          : PermissionDenied: (MSFT_DfsNamespaceFolder:Root\Microsoft\...NamespaceFolder) [New-DfsnFolder], CimException
    + FullyQualifiedErrorId : MI RESULT 2,New-DfsnFolder
    + PSComputerName        : DEVO-FILE02

Somtimes it works, sometimes not... I don't understand...

The account who execute the script is domain admin and I launch the ISE in Admin mode.

Thank you for your help.

Florent