I launched a couple servers in AWS and I want to read the contents of the a file using Powershell.
On server 1 I create a file called App_configuration.txt and placed in the root of c:\.
The file has just 2 lines in it:
<Path>C:\GoodToGo</Path>
<Path>C:\GoodToGo2</Path>
I'm trying to access the file with this command using the remote IP of the server. The xx.xxx.xx.xxx is supposed to be the remote IP:
Get-Content -Path "\\xx.xxx.xx.xxx\c$\App_configuration.txt"
Get-Content : Cannot find path '\\xx.xxx.xx.xxx\c$\App_configuration.txt' because it does not exist.
At line:1 char:1
+ Get-Content -Path "\\xx.xxx.xx.xxx\c$\App_configuration.txt"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\\xx.xxx.xx.xxx\c$\App_configuration.txt:String) [Get-Content], ItemNot
FoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
I can RDP into the remote server and list the file:
PS C:\> ls C:\App_configuration.txt
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/2/2021 4:12 PM 51 App_configuration.txt
I am not the same user on my local machine as the one that can log into the remote machine. The server I am trying to access is in AWS, and I am trying to access it from my local machine.
Why can't I read this remote file with this powershell line?