What error message do you get? Can you better describe your goal? Where does the original item actually exist? From your code it’s looking locally on the system you’re running it from, but I have a feeling the original item might be on PC1.domain.com. Nontheless you need to clarify that.
" Specify the PSSession object to which a remote file is being copied. When you use this parameter, the Destination parameter refers to the local path on the remote machine."
I don’t think you’re using that cmdlet how you are intending. The way it’s written now won’t work, because the destination should be local path based on the remote system in port, but you’re giving it a UNC path. If I had a file on my local computer, and I wanted to put it on PC1.domain.com in c:\temp Then I’d do something like this:
Hi Folks
I didn´t understand why, but I just separated the instructions in two files with the tip neemobeer told me.
First file.ps1: get-aduser…,
Second ps1: from variable $port…
Now worked
Thank you so much
" Specify the PSSession object to which a remote file is being copied. When you use this parameter, the Destination parameter refers to the local path on the remote machine."
Key phrase there is local path your original code references the remote or UNC path