Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8300243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:29:12+00:00 2026-06-08T16:29:12+00:00

I need to clear a folder on a remote server before copying new files

  • 0

I need to clear a folder on a remote server before copying new files to it.

So the script on my client contains the following:

Invoke-Command -Computer $TargetServer -ScriptBlock { Remove-Item $ClearPath }

When I run this I get the following error:

Connecting to remote server failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests

I looked this up on technet, my understanding from this was that if the servers use a proxy (which mine do when trying to get to the internet) then I need to use the $PSSessionOption object. So I changed my script so that the following is first executed:

$User = "group\tfs_service"
$Password = ConvertTo-SecureString -String "x" -AsPlainText -Force
$Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $Password
$PSSessionOption = New-PSSessionOption -ProxyAccessType IEConfig -ProxyAuthentication Negotiate -ProxyCredential $Credential

Now when I run the script I get the following error:

 Connecting to remote server failed with the following error message : The WinRM client cannot process the request. Setting proxy information is not valid when the HTTP transport is specified. Remove the proxy information or change the transport and try the request again

Can anyone please tell me where I’m going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:29:14+00:00Added an answer on June 8, 2026 at 4:29 pm

    It seems I was barking up the wrong tree thinking I needed to configure the proxy. The only problem was that I hadn’t enabled powershell remoting on the remote server. I was able to do this by executing the following command in an elevated powershell window:

    Enable-PSRemoting
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the bin > Debug folder it's clear I will need to copy the
I need to clear the <div> and insert new content I get from the
I need to clear all APC cache entries when I deploy a new version
Hi I need to clear IE8 browser cache before loading my cd-based php application.
I need to create vbscript which will create new folder 'test' and subfolder 'Output'.There
I need to clear the selection from a <select> element. I've already read such
I need to clear/ reset my textbox1 which is set to ReadOnly= true. I
I need to clear the default values from input fields using js, but all
I have a chart and I need to clear it in order to populate
I had a requirement where I need to clear off the select all checkbox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.