troubleshooting Question

getting content from remote files using powershell

Avatar of DevSupport
DevSupport asked on
Powershell
3 Comments1 Solution1847 ViewsLast Modified:
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
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros