Powershell Invoke-Command Remove-Item Remote Server

Question:

I want to delete files on a particular folder of a remote server. I execute the following in Powershell:

I get the following error:

c:\BizTalkDeployment is the correct path on server compname1.

Can anyone please explain what I’ve done wrong?

Answer:

Remove the – in front of $args and re-run the script. You might even try changing the script block to:

Source:

Powershell Invoke-Command Remove-Item Remote Server by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply