Jump to content


Status Filter rules passing variables

Recommended Posts

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



This is working fine. I also wanted to pass the variable for message description so the script was

script.ps1 %msgsys %msgdesc



param([string]$strComputer, [string]$message)


When i run this all that i get is the first word in the message.


The message was

The task sequence has completed successfully


My script will only return



How can i output the entire message not just the first word??









Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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

Share this post

Link to post
Share on other sites

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"

  • Like 2

Share this post

Link to post
Share on other sites

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:

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.