Showing results for 
Search instead for 
Did you mean: 

Powershell CA not logging or reading properties

I am launching a powershell CA from the click of a button, it sends me an email thru office 365. not a problem(I have an inbox full!)
I am trying to get PS to read either string values or properties, or both, so I can have a user fill in all of the info, then it sends on the button push of the form.

If I hard code the connection and mail info everything is fine. If I try to set it to read properties or strings, I get empty strings, yes there are values in there...I checked in the IS log.
Speaking of which.....The trace-suiteinfo -LogMessage does not log a thing in my log when I click show logs, I see that it launched the CA, and I get the email, so I know that worked.
I further tested by setting the subject line to each var, (the property one and the string one) both were blank in tests.

what am I missing? anyone have an example of a simple PS script that works to retrieve what I want and use it?

Powershell code snippet

Set-ExecutionPolicy Unrestricted -force
trace-suiteinfo -LogMessage "POWERSHELL:INFO - Going to try and retrieve NEW_STRING24"
$PropVal = get-suiteproperty -name SMTP_NETWORK_HOST
$StringValue = resolve-suitestring -StringId NEW_STRING24
trace-suiteinfo -LogMessage $StringValue
trace-suiteinfo -LogMessage $PropVal

$emailSmtpServer = ""
$emailSmtpServerPort = "587"
$emailSmtpUser = ""
$emailSmtpPass = "MyPass"

$emailFrom = ""
$emailTo = ""

$emailMessage = New-Object System.Net.Mail.MailMessage( $emailFrom , $emailTo )
$emailMessage.Subject = "Subject is: " + $StringVal + " -- Propval: " + $PropVal
$emailMessage.IsBodyHtml = $true
$emailMessage.Body = @"

Let us see if this works from IS CA....

Here is a message that is HTML formatted.


$SMTPClient = New-Object System.Net.Mail.SmtpClient( $emailSmtpServer , $emailSmtpServerPort )
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential( $emailSmtpUser , $emailSmtpPass );

$SMTPClient.Send( $emailMessage )
Labels (1)
0 Kudos
1 Reply

Re: Powershell CA not logging or reading properties

I debugged a bit further, the error makes sense, the cmdlet is not recognized, so what is the namespace of that?

The term 'trace-suiteinfo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path....
0 Kudos