Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Set-Location in remote server - Error: Path not valid

$
0
0

Hi.

I am trying to set a location using PowerShell in the remote server.

I have tried the below code:

  $s = New-PSSession -ComputerName $ServerName
    Enter-PSSession -Session $s
    Set-Location 'C:'
    Set-Location '$selectedNode.CommandPath'

// CommandPath contains value as below in XML - 
<CommandPath>C:\Program Files\Microsoft Sql server\110\Configuration</CommandPath>

I am able to establish a session on the remote server. I am trying to set the location to path defined in CommandPath node. But I am getting error as Path not valid.

How to fix this?

Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>