- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Powershell CA not logging or reading properties
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Powershell CA not logging or reading properties
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?
Thanks!!!
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 = "smtp.office365.com"
$emailSmtpServerPort = "587"
$emailSmtpUser = "myuser@mydomain.com"
$emailSmtpPass = "MyPass"
$emailFrom = "myemail@mydomain.com"
$emailTo = "mymail@myotherdomain.com"
$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 )
exit(0)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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....
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @azhockeynut
You are correct. It seems the 'trace-suiteinfo' cmdlet is not identified. It requires including of a particular Assembly to the script. I am also searching on the same. The blank values of properties is due to the failure of the execution of script.
I think it needs to be raised as a bug with Flexera to get it work.
Please let me know if it works for you
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @kdsharma ,
Which project type you using?Is it Suite/Basic MSI?
If you are executing specific PowerShell custom action via DoAction event it might not work as per Windows limitation.
Please refer:
As well i could set property as well using :
set-property -name CXS_IP_LOCAL -value $localIpAddress assuming property is been created via Property Manager in basic msi project's custom action as mentioned in the KB:
Thanks,
Jenifer
