Skip to content

Status Filter rules passing variables

Featured Replies

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??

post-17870-0-23526500-1370053542_thumb.jpg

 

 

 

 

 

 

post-17870-0-23526500-1370053542_thumb.jpg

  • 2 weeks later...

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'"

  • Author

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.

  • 3 months later...

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

  • 1 year later...

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"

  • 4 years later...

Join the conversation

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

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.