0

I want to use a Linux path in a Powershell script. I want to write sth in a file with this Command:

Invoke-SshCommand -InvokeOnAll -Command "echo ""$LogFileContent"" > '/vol/Systemcheck/nsclient_ini_Update/Log_nsclient_ini.html'

But I got an error where he said that he can't find the path C:/vol/Systemcheck/nsclient_ini_Update/Log_nsclient_ini.html How can I avoid that PS autocomplete the C:?

1 Answer 1

2

Your file redirection is outside the command you want to run on the remote machine. Therefore, you get PowerShell's interpretation of the path. You are giving an absolute path here (as indicated by the leading / or \) which results in referring to the root directory of the current volume on Windows. If your current working directory is somewhere on C:, then that's what you get.

This may be because you're missing the closing " at the end of the command line. But truth to be told, I think in that case PowerShell would normally just error out with a parsing error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.