Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Hi,
if I write the output from Get-NcCifsSessionFile in variable I got often the XML error message.
Any suggestion to solve the error?
DataOntap 9.8.0
$OpenFilesNC = Get-NcCifsSessionFile -VserverContext $srv | Select Vserver,Share,ShareMode,OpenMode,Path,FileId
Error:
Get-NcCifsSessionFile : There is an error in XML document (1, 6000).
At
+ ... $OpenFilesNC = Get-NcCifsSessionFile -VserverContext $srv |Select ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (.............. :NcController) [Get-NcCifsSessionFile], InvalidOperationException
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.GetNcCifsSessionFile
Solved! See The Solution
Hello
I was able to get your variable to work as is, but i have to use command: Invoke-expression to get it to work.
Per example:
Get-variable -Name test:
Get-NcCifsSessionFile -VserverContext svm1_cluster1 | Select vserver,share,sharemode,openmode,path,fileid
PS> Invoke-expression $test
Hello @JRN1
Can you confirm if you are able to run the command outside of the variable without any issue?
Thanks
Hello @hmoubara ,
yes I can confirm.
I found a way today. If I run it for specific share it works without error.
Have to use "-Query" because no "-Share" is available.
$OpenFilesNC = Get-NcCifsSessionFile -Query @{ Share = $ShareName} |Select Vserver,Share,ShareMode,OpenMode,Path,FileId
Thanks
Hello
I was able to get your variable to work as is, but i have to use command: Invoke-expression to get it to work.
Per example:
Get-variable -Name test:
Get-NcCifsSessionFile -VserverContext svm1_cluster1 | Select vserver,share,sharemode,openmode,path,fileid
PS> Invoke-expression $test
Hi thanks for finding that out.
Both solutions looks to work.