Invoke-RestMethod Powershell for upload and install package in AEM not using cURL | Community
Skip to main content
Chandra_gupta
New Participant
October 16, 2015
Solved

Invoke-RestMethod Powershell for upload and install package in AEM not using cURL

  • October 16, 2015
  • 1 reply
  • 2268 views

Anybody were able to manage package upload and install using power-shell in windows not using cURL? please share some thoughts?

One things is sure cURL is lot easier than power shell.I am also aware cURL can be used in power-shell... But in nutshell i want to use similar to Invoke-RestMethod.

http://psscripts.blogspot.com/2012/09/powershell-v30-invoke-webrequest.html

 

Thanks,

Chandra

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni
Hi Chandra gupta

What is the specific reason of using powershell instead of curl, and specific use case?

Basically you need to checkout powershell equivalent of curl commands.

Yous can find all curl commands at :- https://gist.github.com/sergeimuller/2916697

For example, "curl -u {user}:{pass} {url}" equivalent of powershell is

$webclient = new-object system.net.webclient;
$User = "user";
$PWord = ConvertTo-SecureString –String "P@sSwOrd" –AsPlainText -Force
$Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord;
$webclient.Credentials = $Credential;
$webclient.DownloadString('url');


You can even call crul commands from powershell, if this could help you Link:- http://stackoverflow.com/questions/30807318/running-curl-via-powershell-how-to-construct-arguments.



I hope this would help you.

Thanks and Regards

Kautuk Sahni

1 reply

kautuk_sahni
kautuk_sahniAccepted solution
Employee
October 16, 2015
Hi Chandra gupta

What is the specific reason of using powershell instead of curl, and specific use case?

Basically you need to checkout powershell equivalent of curl commands.

Yous can find all curl commands at :- https://gist.github.com/sergeimuller/2916697

For example, "curl -u {user}:{pass} {url}" equivalent of powershell is

$webclient = new-object system.net.webclient;
$User = "user";
$PWord = ConvertTo-SecureString –String "P@sSwOrd" –AsPlainText -Force
$Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord;
$webclient.Credentials = $Credential;
$webclient.DownloadString('url');


You can even call crul commands from powershell, if this could help you Link:- http://stackoverflow.com/questions/30807318/running-curl-via-powershell-how-to-construct-arguments.



I hope this would help you.

Thanks and Regards

Kautuk Sahni
Kautuk Sahni