Microsoft Virtualization Discussions

Powershell Read-ncfile cant find file

drydholm
2,483 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
2,408 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
2,409 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
2,288 Views

Hi JohnChampion,

 

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

Public