mopey85 Posted June 1, 2013 Report post Posted June 1, 2013 Hey Guys, I have just set up a filter rule to email me the status of software deployments by running a powershell script. I am currently passing the name into the powershell script by using this command script.ps1 %msgsys then within the first line of powershell i use param([string]$strComputer) This is working fine. I also wanted to pass the variable for message description so the script was script.ps1 %msgsys %msgdesc Powershell param([string]$strComputer, [string]$message) When i run this all that i get is the first word in the message. example The message was The task sequence has completed successfully My script will only return "The" How can i output the entire message not just the first word?? Quote Share this post Link to post Share on other sites More sharing options...
risjard Posted June 11, 2013 Report post Posted June 11, 2013 Mine looks like this and works fine: "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" "E:\Powershell_scripts\OSD_Provisioning_SCCM\email_OSD.ps1 '%msgsys' '%msgdesc'" Quote Share this post Link to post Share on other sites More sharing options...
mopey85 Posted June 13, 2013 Report post Posted June 13, 2013 Mine looks like this and works fine: "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" "E:\Powershell_scripts\OSD_Provisioning_SCCM\email_OSD.ps1 '%msgsys' '%msgdesc'" I notices you put singe inverted commas around %msgdesc. i will try that and see how it goes. UPDATE: So no luck. I am wondering if it has something to do with setting execution policy and all of the other commands i have before it. Quote Share this post Link to post Share on other sites More sharing options...
JMR Posted October 3, 2013 Report post Posted October 3, 2013 With PowerShell 2.0 you can bypass the security policy with : C:\WINNT\SysWOW64\windowspowershell\v1.0\powershell.exe -executionpolicy bypass -file E:\Powershell_scripts\OSD_Provisioning_SCCM\email_OSD.ps1 %msgsys Quote Share this post Link to post Share on other sites More sharing options...
chibeatz Posted April 3, 2015 Report post Posted April 3, 2015 After a hour of testing I found out that you must add double quotes around "%msgdesc" to get the full description. Example of how my command line works: "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe" -executionpolicy bypass -file "D:\scripts\Dcreation.ps1" -message "%msgdesc" 2 Quote Share this post Link to post Share on other sites More sharing options...
Paul W Posted August 6, 2019 Report post Posted August 6, 2019 This is old but i find this the most successful in playing with this today: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "& {C:\Send-Alerts.ps1 '%msgid' '%msgltY-%msggmtm-%msggmtd %msggmtH:%msggmtM:%msggmtS' '%msgdesc'}" Adapted from here:https://blog.nowmicro.com/2018/01/22/email-notification-for-security-changes-in-configmgr/ Quote Share this post Link to post Share on other sites More sharing options...