curl – resolving error – curl : The remote name could not be resolved: ‘–help’

curl error - The remote name could not be resolved: '--help'
curl error - The remote name could not be resolved: '--help'

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

Today again new issue and solution 🙂

Since working on curl for executing SharePoint REST API. Exploring curl and trying to get resolve issues

Background : From one of the UNIX team I got the request that they want to get documents list from our SharePoint Online site. They need REST API for the same and that they can execute with CURL

Since curl is new for me, started exploring and first step is getting curl help

I started SharePoint Online Management Shell and executed following command (We could execute the CMDLET in PowerShell ISE as well)

curl --help

On execution of above command I got the following issue :

curl : The remote name could not be resolved: ‘–help’

At line:1 char:1curl –help

+curl –help

+~~~

CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Fig 1 : curl – error – The remote name could not be resolved –help

But when I execute same command with “.exe” extension as follows I am getting the result. So bit surprising

curl.exe --help

Cause of an error :

  • After bit googling I found that this is something related to Aliases
  • curl and Invoke-WebRequest are aliases in PowerShell as shown in above error and this is the reason only curl command is not working but curl.exe is working

What are Aliases :

  • An alias is an alternate name or nickname for a cmdlet or for a command element, such as a function, script, file, or executable file.
  • We can use the alias instead of the command name in any PowerShell commands
  • We could get the list of all aliases in PowerShell by using Get-Alias PowerShell cmdlet as
Get-Alias

curl - Get-Alias cmdlet
Fig : curl – Get-Alias cmdlet

Solution :

  • There is an option – to remove alias for curl
  • We can use Remove-Alias cmdlet
  • Syntax for Remove-Alias cmdlet

Remove-Alias
      [-Name] <String[]>
      [-Scope <String>]
      [-Force]
      [<CommonParameters>]

  • Please note – Remove-Alias CMDLET is available PowerShell 6
  • If you have older version then please use CMDLET – Remove-Item
  • Syntax for Remove-Item
Remove-Item
      [-Path] <String[]>
      [-Filter <String>]
      [-Include <String[]>]
      [-Exclude <String[]>]
      [-Recurse]
      [-Force]
      [-Credential <PSCredential>]
      [-WhatIf]
      [-Confirm]
      [-Stream <String[]>]
      [<CommonParameters>]

curl - executing Remove-Item - Removing the alias for curl
Fig : curl – executing Remove-Item – Removing the alias for curl

Our other curl article – Microsoft 365 – resolving error : curl: (1) Protocol “‘https” not supported or disabled in libcurl – https://knowledge-junction.in/2021/12/04/microsoft-365-resolving-error-curl-1-protocol-https-not-supported-or-disabled-in-libcurl/

Thanks for reading 🙂 HAVE A GREAT TIME AHEAD 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

1 Response

  1. December 11, 2021

    […] curl – resolving error – curl : The remote name could not be resolved: ‘–help’ – https://knowledge-junction.com/2021/12/07/curl-resolving-error-curl-the-remote-name-could-not-be-res&#8230; […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Microsoft 365

Subscribe now to keep reading and get access to the full archive.

Continue reading