Support Forum: Get Support for Patch My PC Products and Services

Microsoft Configuration Manager and Intune (Enterprises/Paid) => Support and General Questions (Enterprises Using ConfigMgr and Intune) => Topic started by: alecdombrowski on February 09, 2024, 11:59:37 AM

Title: Custom Pre/Post Script with Product Name and Vendor
Post by: alecdombrowski on February 09, 2024, 11:59:37 AM
I'm setting up pre and post scripts to log to the event viewer when PMPC installs or updates an app (Intune). I am trying to pass the vendor name and product name but PMPC is passing some odd string instead of actual app and vendor names. I have only tested with Amazon Workspace, but before I test more I want to know if this is normal and should be expected

In order...
-MyParameter "%VendorName%, %ProductName%, %Version%, %PackageID%"
QW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLg==  QW1hem9uIFdvcmtTcGFjZXM=  5.18.0.4508  7d614a86-0cfc-44ff-b9e2-d13fa6c64a27  0
Title: Re: Custom Pre/Post Script with Product Name and Vendor
Post by: Cody Mathis (Patch My PC) on February 09, 2024, 12:43:13 PM
Hi there!

We have some documentation for this. We encode the values to ensure they do not cause any parsing issues. See the documentation below for an example of decoding the value in your script.

https://patchmypc.com/pass-variables-into-pre-and-post-scripts  (https://patchmypc.com/pass-variables-into-pre-and-post-scripts)
Title: Re: Custom Pre/Post Script with Product Name and Vendor
Post by: alecdombrowski on February 09, 2024, 01:03:50 PM
Awesome, ty!

Does that mean this article here may not be valid? It talks about how the you can't use traditional PowerShell syntax to pass an array for the arguments. It looks like the article you linked above is allowing multiple arugements to be used, which I'm assuming the script has them in an array? https://patchmypc.com/custom-options-available-for-third-party-updates-and-applications#custom-scripts

"Note: When specifying a PowerShell .ps1 script file for either a pre or post-update script, and you attempt to pass an argument which accepts an array, you cannot use traditional PowerShell syntax."
Title: Re: Custom Pre/Post Script with Product Name and Vendor
Post by: Cody Mathis (Patch My PC) on February 09, 2024, 01:08:46 PM
This would still apply as well. Note it is very specifically if an argument accepts an array of strings.
Title: Re: Custom Pre/Post Script with Product Name and Vendor
Post by: alecdombrowski on February 09, 2024, 01:26:59 PM
Oh I misread the article then, thanks for the help!
Title: Re: Custom Pre/Post Script with Product Name and Vendor
Post by: Cody Mathis (Patch My PC) on February 09, 2024, 01:35:36 PM
Glad to help! Feel free to reach back out if you run into any trouble.