Expand my Community achievements bar.

SOLVED

How do I use Powershell to request a package build

Avatar

Level 2

Hi everyone,

I am trying to use PowerShell to have a package rebuild on request.

What I have so far is

$client = new-object System.Net.WebClient

$client.Credentials = Get-Credential

$client.UploadString("http://localhost:4502/crx/packmgr/service/,json/packages/ExportsFromProd/export-package.zip","param=build")

Can someone please advise where I am going wrong?

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

Please have a look at this slimier forum post:- 

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

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

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.

 

Some Reference articles are:- 

Link:- http://thesociablegeek.com/azure/using-curl-in-powershell/

//Using Curl In Powershell

Link:- http://superuser.com/questions/344927/powershell-equivalent-of-curl

// PowerShell equivalent of curl

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Employee

I would compare your http-request with the one from packagemanager.

Avatar

Correct answer by
Administrator

Hi 

Please have a look at this slimier forum post:- 

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

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

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.

 

Some Reference articles are:- 

Link:- http://thesociablegeek.com/azure/using-curl-in-powershell/

//Using Curl In Powershell

Link:- http://superuser.com/questions/344927/powershell-equivalent-of-curl

// PowerShell equivalent of curl

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni