1

I'm sorry if that question already got asked but I didn't find anything around here so here I go:

So I wrote a little PowerShell Script to ease the work for our IT Colleagues (Ping IPs/Computernames, open the Log files of the User, start a remote job of the computer etc.)

To start a remote job on given IP / Computername, I used this:

C:\Users\user\Desktop\Toolv1\RemoteControlViewer_SCCM2012\CmRcViewer.exe $objTextBox.Text

This works fine on my Computer at the moment, but how do I insert a variable Path that uses the current Path + *\RemoteControlViewer_SCCM2012\CmRcViewer.exe $objTextBox.Text so I can share my Script with my colleagues without changing the Path each time in the script?

I already tried things like:

($PSScriptRoot + \RemoteControlViewer_SCCM2012\CmRcViewer.exe) $objTextBox.Text

But I guess I'm doing something wrong.

Any tips?

1 Answer 1

2

Use Join-Path to construct the full path, then & to invoke the executable:

& (Join-Path $PSScriptRoot RemoteControlViewer_SCCM2012\CmRcViewer.exe) $objTextBox.Text
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.