Hi,
We are building automate email process that use powershell script TASK in Certify Certificat manager that would be able to send email containing the zip file of the certificat to some recipients.
The script is working well using command line and allow flexibility to pass parameters like recipients, cc, replyto…etc.
We can use array of string to have multiple email address and it working correctly in powershell cli…
.\Send-RenewCertificateEmail.ps1 -CertificatDomain vhubapp.com -ZipFilePath “zippath…” -ReplyToEmail “replyTo…”,“replyto2” -Recipients “recipient” -CcRecipients "cc1,“cc2” -LogFolderPath “logPath”
But when i try to put that in the “Argument” field in a deployment task…it always complain about “An invalid character was found in the mail header”.
I try multiple way, but unfortunately found a good one…
Anyone have informations on how to passe array of string in the deployment task ???
Did you try passing multiple arguments? The format is arg1=value;arg2=value
e.g. CertificatDomain =example.com;ZipFilePath=C:\temp\cert.zip;CcRecipients =cc1@test.com,cc2@test.com
Powershell string escaping may be applied where applicable.
One simple workaround would be to have a wrapper script for each combination, which then calls your other powershell.
Here is an example script for debugging passed in arguments:
param($result)
echo "There are a total of $($args.count) arguments"
for ( $i = 0; $i -lt $args.count; $i++ ) {
echo "Argument $i is $($args[$i])"
}
echo $result.ManagedItem.CertificatePath
Can I also ask how the certificates are used by recipients? It seems like there may be an alternative solution instead of emailing a certificate around.
Yes i try multiple variation
- CertificatDomain =example.com;ZipFilePath=C:\temp\cert.zip;CcRecipients =cc1@test.com,cc2@test.com
- CertificatDomain =example.com;ZipFilePath=C:\temp\cert.zip;CcRecipients =“cc1@test.com,cc2@test.com”
- CertificatDomain =example.com;ZipFilePath=C:\temp\cert.zip;CcRecipients =“cc1@test.com”,“cc2@test.com”
- CertificatDomain =example.com;ZipFilePath=C:\temp\cert.zip;CcRecipients =@(“cc1@test.com”,“cc2@test.com”)
-…etc
Some \ added because i’m limited in term of pseudo links as new user
The recipients of those emails apply it to AWS components for website! Not sure if it directly on those servers like on apache or using AWS feature like load balancer of thing like that.
As this point, the email was the easiest and fatest option to do for now until we automate completely!
To debug what’s going wrong and help you format the arguments I think we would need to see a copy of your script, with anything secret replaced.
Hi,
The main question is : How to pass an array of string using the argument field pattern arg1=value1,value2;arg2=value1,value2
In powershell cli we would do something like: -arg1 “value1”,“value2”
I think we can do it only by having a full string and splitting it directly into the script…Am i right or there other possibility
Hi, yes I would suggest quoting the value as a string “address1,address2” then string splitting on the comma.
The main reason for this difference between the command line and the app is that the app is not normally using the command line at all, it’s using an in-process hosted version of powershell.
Hi,
That what i finally try and succeed!!!
Do you know the reason behind the argument format “var1=value” instead of classical argurment pattern to powershell script??