NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform.
You will still be able to view content, but posting and replying will be temporarily disabled.
To learn more, please review the information in this blog post.

Microsoft Virtualization Discussions

Powershell Read-ncfile cant find file

drydholm
4,008 Views

Hi 

I was hoping someone could help me.

I'm trying to run the powershell command Read-ncfile and get the command-history.log but the command fails with can't find file.

For exampel i run the following which fails

Read-NcFile -Path /vol/vol0/etc/log/mlog/command-history.log -VserverContext Cluster1-Node1

 

But the following command does not fail

Read-NcFile -Path /vol/vol0/etc/log/mlog/vifmgr.log -VserverContext Cluster1-Node1

 

from what I'v tried it only fails when there is a "-" character in the name of the file.  I'v tried adding a escape character like / or ` but it does not make any difference.

Anyone got any ideas? 

1 ACCEPTED SOLUTION

JohnChampion
3,933 Views

I did a Get-NcFile for the two files.  The command-history.log is a symbolic link while the vifmgr.log is an actual file.  Looks like Read-NcFile only works for the actual file paths and doesn't support symbolic links. 

readncfile.jpg

A workaround might be to go through the SPI interface (https://{clusterip}/spi) using Invoke-WebRequest or Invoke-RestMethod. 

View solution in original post

2 REPLIES 2

JohnChampion
3,934 Views

I did a Get-NcFile for the two files.  The command-history.log is a symbolic link while the vifmgr.log is an actual file.  Looks like Read-NcFile only works for the actual file paths and doesn't support symbolic links. 

readncfile.jpg

A workaround might be to go through the SPI interface (https://{clusterip}/spi) using Invoke-WebRequest or Invoke-RestMethod. 

drydholm
3,813 Views

Hi JohnChampion,

 

I did a invoke-WebRequest and it worked great. Thanks for the help.

Public