Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Administrator
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

View solution in original post

1 Reply

Avatar

Correct answer by
Administrator
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