Avatar of DevSupport
DevSupport

asked on 

getting content from remote files using powershell

I have a file (context.txt - attached) in remote servers which have some value in them,

I would like to use a powershell command to get those values from a remote server.

I am trying this way:

$pathofcontextfile=C:/application/conf/context.txt
$envname=url/initialization/explicittempdir

$remotevalue = Invoke-Command -ComputerName svcname -ArgumentList ($pathofcontextfile, $envname) - ScriptBlock {Param($pathofcontextfile, $envname); Get-Content $pathofcontextfile get-the-value-from-file-which-in-this-case-is-C:/TempDir}

i am not sure what to write after Get-Content to get the value of explicittempdir value into $remoteval variable.

Any help would be highly appreciated.

Thanks
DevSupport
context.txt
Powershell

Avatar of undefined
Last Comment
DevSupport

8/22/2022 - Mon