asjimene / cmpackager Goto Github PK
View Code? Open in Web Editor NEWCreates ConfigMgr Applications using XML Recipe Files
License: MIT License
Creates ConfigMgr Applications using XML Recipe Files
License: MIT License
I like to have my source applications as \ContentLocationRoot\Publisher\Application\Version
For example
Microsoft\Office\2019
Adobe\Acrobat\Reader\2020.123.123
Adobe\Acrobat\Pro\12
Autodesk\InventorPro\2022
I tried changing the name in the recipe. This creates the desired structure, but the resulting application in MECM has the same Adobe\Acrobat\Reader name. My Feature request to have a custom path in the recipe please.
It would be helpful when creating new recipes to be able to have a parameter where you can specify a single recipe. Currently you either have to have a separate development instance or move the production recipes out while testing and move them back when done testing.
Hi,
After downloading your tool on feb 26th 2020, I found out that the script doesn't create Google Chrome's application. According to Powershell, it fails to find GoogleChrome’s version.
It does download the msi, but then deletes it and fails.
Thank you!
Current x86 and x64 packages are downloaded into the same source folder for the package. Create x86/x64 or x32/64 folders instead and put corresponding source files in each. Then have the individual deployment types for each processor architecture reference the processor type sub folder. This would reduce the size of the deployment package that has to be downloaded.
Current:
Proposed:
Allow full configuration of content path, with variable support.
If I want to throw my files in $Manufacturer\Packages\Potato$ApplicationName$Version, that should be my choice darn it!
The script will throw errors messages when trying to apply rules to an application if you use any name other than "Application Requirements Template". The issues is due to the script not importing the name of the "RequirementsTemplateAppName". It currently uses a hard coded string.
The auto generated template is called "Application Requirements Template 1" causing rules to fail for most users.
Line 37 needs to be changed to:
$Global:RequirementsTemplateAppName = $PackagerPrefs.PackagerPrefs.RequirementsTemplateAppName
Error:
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
Workaround:
Adding TLS1.2 Security Protocol Type to the script allows for HTTPS Invoke-WebRequest downloads to work
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Hey!
Thank you for developing this fantastic tool!
I've been using it a while now and have two questions, I'm not sure if they are already features or whether I need to request them as enhancements?
1, How do I provide SMTP authentication? SMTP server requires authentication and I can't work this one out or if it is possible.
2, Deployment type, I have Auto deployment turned on to a collection, is there a way I can specify the deployment to be Required rather than Available? I have supercendence and for some apps EG Chrome, I would like to force the new version out to people.
Following on from question to is there a way I can make a required deployment to one collection by available to another? EG Two collections, all PC's and All PC's with chrome installed. Is there a way to make available to all PC's and required to All PC's With chrome?
Thank you for your hard work!
Jon
I am getting the error message below for whatever recipe I am trying to use from your CMpackager script. Any insight will be appreciated.
Error processing Notepad++.xml: Object reference not set to an instance of an object. at Start-ApplicationDownload, C:\Temp\Main\CMPackager-main\CMPackager.ps1: line 533
at , C:\Temp\Main\CMPackager-main\CMPackager.ps1: line 2081
Updated recipe to include:
Updated recipe to remove:
*Note: I am new to contributing to github, and I struggled trying to get a pull request to submit this correctly with the changed Blender.xml file, so if someone is willing to provide some guidance, I would be very appreciative. I have several recipes that I'd like to contribute now and in the future.
Blender.zip
Is there a possibility to set 2 different deployments for one application with the CMPackager script?
For example:
Application A deployment required for collection A (Collection with already installed application)
Application A deployment available for collection B (collection with all systems, for user installation with software center)
I have tried to set up 2 different CMPackager scripts, one setting available and the other setting required deployments.
But as soon as one of the two scripts deploys the first application in sccm, the second script does not perform any additional deployment.
I've ran into an issue with some applications that have many versions where, when the recipe has supersedence configured for "true", that it will attempt to supersedence really old or retired applications. For my case (Firefox ESR), we had 5 versions in SCCM with one in production and 4 superseded and retired. When the newest version came out, it tried to supersede the first two applications, not the most recent.
In line 1390 of the CMPackager.ps1 (under the Invoke-ApplicationSupersedence function), would it make sense to exclude retired applications from the latest applications (Where-Object {$.IsExpired -eq $False})? Or maybe even excluding apps that are already superseded (Where-Object {$.IsSuperseded -eq $False})? Maybe even just doing the "Select-Object -last 2" instead of "Select-Object -first 2" to account for the newly created app and the most recently deployed application?
AutoPackage - OSArchitecture x64 condition creates a rule for the Win32_ComputerSystem class looking for an OSArchitecture property. This property is a member of the Win32_OperatingSystem class.
Line 33 of CreateGlobalConditionsAndRequirements.ps1 should be the following:
New-CMGlobalConditionWqlQuery -DataType String -Class Win32_OperatingSystem -Namespace root\cimv2 -Property OSArchitecture -WhereClause "OSArchitecture =
'64-bit'" -Name "AutoPackage - OSArchitecture x64" -Description "Returns True if Win32_OperatingSystem is True. Use as existential rule for 64-bit operating system"
Hello,
Is it possible to use this to package applications with no download, but instead use 2 copy commands to merge a settings file and install script with the latest build contents?
For example
C:\InstallerTemplates\Application1
C:\Builds\Application1\10.1.32.12\
In this instance the build is taken, merged with PSADT and the script package is built.
Hi,
I would just like to seek your assistance regarding the reciper for Adobe Reader please.
Please correct me if I'm wrong and if this is something that can be corrected. The version of my cmpackager was Created on: 1/9/2018 11:34 AM
There are two issues that I have discovered:
see screenshots below from version 22.1.20085
Version: 22.3.20314
regards,
CA
Hello,
Apologies if this isn't the correct place for this. This is my first post here.
I may have missed it somewhere in either the Powershell script or the Template.xml, but I can't see a way of setting the detection method connector to "And" or "Or" when setting up more than one detection clause. Is there a way to do this and if so are you able to add it into either the template.xml or the powershell script?
Many Thanks,
Jim
<PrefetchScript>$latestVersion = (((Invoke-WebRequest https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html) |Select-Object -ExpandProperty Links | where {$_.outertext -like "1* Planned Update, *"} |where {$_.href -like "continuous*"}|Sort-Object -Property innerText -Descending).innerText).Split(" ").replace(".","")[0]
<PrefetchScript>$latestVersion = (((Invoke-WebRequest https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html) |Select-Object -ExpandProperty Links | where {$_.outertext -like "2* Planned Update, *"} |where {$_.href -like "continuous*"}|Sort-Object -Property innerText -Descending).innerText).Split(" ").replace(".","")[0]
I noticed the other day my reader app hadn't updated. I did do a quick test to ensure 20.X is the continuation of 19.X. Installed 19.X and initiated an update via the app itself which took me to 20.X.
Something people can easily update themselves but seems a good idea to update the base recipe as well.
If you ever start up a donation site (paypal or whatever) shoot me the details. Your script has saved me hundreds of hours. Least I can do is buy your next cup of coffee.
Hi
It would be wery useful if the script could compare versions before downloading the installer.
Some applications have versionnumbers in their download URL or website.
I think it could be made adding extra variable(line) in XML which result would be Version variable to compare with SCCM before downloading.
What do you think?
Hi, how are you? I'd like to collaborate on your open source project and propose free logo/icon design for this project. If it's something you're interested in, please, let me know!
Best Regards
Zuur
Hi,
First of all good job on the script, it is of great help!
The issue that I am facing is suddenly when running the script first time (wanted to re-install the whole script components) is that in the logs says "WARN: The Requirements Application has been created, please do the following:
"WARN: The Requirements Application has been created, please do the following:"
"1. Add an "Install Behavior" entry to the "Templates" deployment type of the Application Requirements Template Application"
"2. Run the SCCMPackager again to finish prerequisite setup and begin packaging software."
I tried adding some dummy Install Behavior to Application Requirements Template Application - Requirements Template but it still is showing the same error.
Can you please advise what could I be doing wrong?
Thank you!
Idea from comment: Automatically clean up old versions, have a configurable number of versions to keep.
Software that makes releases that aren't always in normal numerical order can currently end up with a higher release number superseded by a lower release number since supersedence always picks the most recently created application as the "old version", for example, PowerShell releasing 7.0.4 after 7.1.1 so 7.0.4 ends up superseding 7.1.1.
Line 1618 in ae41869
The current system works fine in most situations and is great for software that doesn't have comparable version numbers for releases, but can't handle this at all - any thoughts? I can see two options
Invoke-VersionCheck
, possibly per-applicationInvoke-ApplicationSupersedence
to use version number then date created and only superseding a lower version, also possibly per-application and possibly by defaultHi asjimene,
Good day!
just wanted to seek your assistance regarding some recipes I am having issues with please.
I have some recipes which I grabbed here and for some reason some of them are not downloading the Application from the website. These are:
The only working recipe that I have is Microsoft Power BI.
I have attached the notepad text when I ran the app.
cmpackager-notepad.txt
regards,
CA
I'm looking for expanded flexibility with the MSI deployment types such that the is respected for more that just MSI and CustomScript detection types.
Currently with MSI deployment types, the capability exists (from the Template.xml and looking through the "Special Arguments based on Detection Methods" in the Add-DeploymentType function) that a recipe can be an MSI type with MSI detection or CustomScript. However, it does not allow for Custom detection (specially, with file detections). I typically prefer to use this, and have used this over the MSI product code when the vendors don't use different codes for new versions.
Would it be possible to add the "Custom" detection to that Switch so that the is respected?
Have the ability to define the pattern for how apps show up in the console instead of just the default $Application $Version
Examples:
Hi Andrew,
just saw your project. That is a really cool thing.
I am working in the same field, but we use
AutoPkg for Windows.
A few guys have ported the original AutoPkg to Windows, which was not that hard, because it is written in Python. The intention is to port this fork back to the main project ASAP.
What i like the most so far with AutoPkg, that there is already a huge developer and user base on the Mac-side, from which we can profit.
So, i concentrated mostly on building processors for specific task around the Windows Installer field.
Are you maybe interested to merge your project with AutoPkg for Windows?
That would give you more time to focus on the (huge) field around importing and configuring stuff on SCCM.
What do you think about this?
BR, Nick
Hi,
I just tested CMPackager today, and found it is great!
Just to let you know, I set supersedence for Chrome app, and while it worked I got this warning:
AVERTISSEMENT : The cmdlet 'Add-CMDeploymentTypeSupersedence' has been deprecated and may be removed in a future release. The cmdlet 'Set-CMApplicationSupersedence' may be used as a replacement.
I used latest version as I downloaded main branch files from here today.
Greetings
When the recipe is using "CustomScript" for DetectionMethodType and attempting to use the $FullVersion variable in the detection script, the variable is empty even though it was verified before in the log that it was captured and even forcefully put in the section. Using $Version works without issue.
In line 981 of the CMPackager.ps1 (under the Add-DeploymentType function), there is the replacement of text for $Version and $FullVersion. In testing, I've noticed that by changing the $FullVersion replacement to mirror the action for the $Version, the $FullVersion variable comes through in the script detection. I've seen the replacement occur elsewhere throughout the script, as well, and it may be problematic as well, but this is where I've noticed issues recalling the variable for use.
Using the latest version of CMPackager.ps1, -singlerecipe parameter is broken because $PSScriptRoot (line 31 & line 39) is not enumerating. $PSScriptRoot is $null so line 48 fails due to the path not resolving.
FYI, I was getting errors any time the Set-Location cmdlet tried to change to the CMSite provider location because a PSDrive for that provider had never been established. I added the missing New-PSDrive logic at the appropriate location in the main script and everything is good now.
When deploying an application if the ApplicationDescription has spaces the app creation will fail.
New-CMApplication -Name "$ApplicationName $ApplicationSWVersion" -Description $ApplicationDescription -Publisher "$ApplicationPublisher" -SoftwareVersion $ApplicationSWVersion -OptionalReference $ApplicationDocURL -AutoInstall $ApplicationAutoInstall -ReleaseDate (Get-Date) -LocalizedName "$ApplicationName $ApplicationSWVersion" -LocalizedDescription $ApplicationDescription -UserDocumentation "$ApplicationDocURL" -IconLocationFile $ApplicationIcon
Fix is to add quotations around $ApplicationDescription:
New-CMApplication -Name "$ApplicationName $ApplicationSWVersion" -Description $ApplicationDescription -Publisher "$ApplicationPublisher" -SoftwareVersion $ApplicationSWVersion -OptionalReference $ApplicationDocURL -AutoInstall $ApplicationAutoInstall -ReleaseDate (Get-Date) -LocalizedName "$ApplicationName $ApplicationSWVersion" -LocalizedDescription "$ApplicationDescription" -UserDocumentation $ApplicationDocURL -IconLocationFile $ApplicationIcon
Same applies for line 376
Hi Team
Need some help with recipe for October patch for.
it has only worked for Google Chrome, Firefox and Power BI.
it hasn't pulled anything for iTtunes, VLC Player, Adobe Acrobat Reader, NotePad++,
i have tried multiple times but still no go. in first attempt, it created the application but had no version number or data in it. which i have cleared now.
Thanks
Vik
saw that you recently added the feature that makes the automatic removal of previous versions, but downloading the content in the zip, I didn't see the adjustment of this parameter. Is there a procedure that needs to be done?
About SCCM, I created a folder in Applications with the name of CMPackager, so I can make the deployment be done directly inside this subfolder?
Adding the following code at line 1054 in the SCCMPackager.ps1 would allow for deploying the application to multiple collections by specifying additional DeploymentCollection nodes.
ForEach($Collection in $Recipe.ApplicationDef.Deployment.DeploymentCollection){
Also, you'll need to replace $Recipe.ApplicationDef.Deployment.DeploymentCollection with $Collection in the New-CMApplicationDeployment parameters.
And the corresponding } at line 1065.
The Dell Command | Monitor XML doesn't work OOB.
Tweaking is ongoing, but I am having trouble with the HTTPSHeaders switch on ln 479. I've declared $HTTPSHeaders in the PrefetchScript, but it doesn't seem to be passing through to $request.
Hello
Found out that it still not possible to use Variables in detection method.
Tested like that:
defined in DownloadVersionCheck
$FileVersion = "4.2.3.66"
running the script
Add-LogContent "$detMethodCommand"
Writes to log -ExpectedValue "$FileVersion"
Tried both:
and
no difference.
same with that one also
can you help?
I do not see a way to add a repair command in the recipies. Are you looking to add this eventually?
Allow newly packaged applications to supersede the previously packaged version automatically. This should be configurable per app.
The Firefox MSI isn't a real MSI so you cannot detect it's installation based off the MSI product code.
Changing the detection to ignore the MSI Product code and only detect version fixes this.
Looking into the recipe I notice it must auto add the product code when deploying from MSI since the MSI detection isn't in the recipe... can we remove this auto-added detection method or change the File version detection to automatically be OR instead of AND?
Add an "-InitialSetup" flag to walk through setting up the XML. Have it run automatically if needed.
Thank you so much for this wonderful script. Would it be possible to generate an app based on a local MSI and icon.
Thanks
Hi Guys,
I am currently experiencing an issue with one of the recipes. Every recipes I have our identical to the cmpackger downloaded from github.
The recipe we are having issues with is AdobeReader.xml. It gets stuck at the downloading part and it seems like it times out.
I get this error message after waiting for 5-10 mins before it proceeds to the next recipe.
other recipes works fine.
Here is the error message. any ideas? hoping for your immediate assistance.
regards,
CA
Title in Software Center does not need the version string attached. Add option to not include the version string to the Display Title.
If you specify -RecipePath
with a trailing backslash (like PowerShell's default tab completion produces), the path is mis-set and CMPackager attempts to find recipes in cwd.
Without the trailing backslash, it works correctly. This is due to $RecipePath
being a FileInfo
rather than eg a DirectoryInfo
Line 39 in 8241aba
Trying to get this to work but it does nothing?
Mozilla Firefox The Firefox Edition is a version of Firefox that's tailored for web users. It includes: the latest Firefox features. Each new release includes features which have been stabilized via nightly builds. Free Software. Mozilla True https://support.mozilla.org/en-US/products/firefox?utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=nav&utm_content=firefox FirefoxDev.ico Function Get-RedirectedUrl { Param ( [Parameter(Mandatory=$true)] [String]$URL ) $request = [System.Net.WebRequest]::Create($url) $request.AllowAutoRedirect=$false $response=$request.GetResponse() If ($response.StatusCode -eq "Found") { $response.GetResponseHeader("Location") } } $FileName = ([System.IO.Path]::GetFileName((Get-RedirectedUrl "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US"))).replace("%20"," ")
Invoke-WebRequest -uri "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US" -Outfile "$TempDir\$FileName"
$LatestVersion = ((Get-ChildItem "$Filename").Name).Trimstart("Firefox Setup ").TrimEnd(".exe")
$URL = "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US"
Add-LogContent $LatestVersion
Add-LogContent $URL
</PrefetchScript>
<URL></URL>
<DownloadFileName>
(Get-ChildItem "$TempDir\$FileName" |Select-Object -ExpandProperty BaseName)
</DownloadFileName>
<Version></Version>
<FullVersion></FullVersion>
<DownloadVersionCheck>
$Version = ((get-Childitem $TempDir\$FileName).Name)
$FileVersion = ((get-Childitem $TempDir\$FileName).Name)
$FullVersion = (Get-ChildItem "$TempDir\$FileName" |Select-Object -ExpandProperty BaseName)
</DownloadVersionCheck>
</Download>
</Downloads>
<DeploymentTypes>
<DeploymentType Name="DeploymentType1">
<DeploymentTypeName>Firefox Enterprise x64 Silent Install</DeploymentTypeName>
<InstallationType>Script</InstallationType>
<CacheContent>False</CacheContent>
<BranchCache>True</BranchCache>
<ContentFallback>True</ContentFallback>
<OnSlowNetwork>Download</OnSlowNetwork>
<InstallProgram>$FileName -ms</InstallProgram>
<UninstallCmd>`"%ProgramFiles%\Mozilla Firefox\uninstall\helper.exe`" -ms</UninstallCmd>
<InstallationBehaviorType>InstallForSystem</InstallationBehaviorType>
<LogonReqType>WhetherOrNotUserLoggedOn</LogonReqType>
<UserInteractionMode>Hidden</UserInteractionMode>
<EstRuntimeMins>5</EstRuntimeMins>
<MaxRuntimeMins>20</MaxRuntimeMins>
<RebootBehavior>BasedOnExitCode</RebootBehavior>
<DetectionMethodType>Custom</DetectionMethodType>
<CustomDetectionMethods>
<DetectionClause>
<DetectionClauseType>File</DetectionClauseType>
<Name>firefox.exe</Name>
<Path>%ProgramFiles%\Mozilla Firefox</Path>
<PropertyType>Version</PropertyType>
<ExpectedValue>$FullVersion</ExpectedValue>
<ExpressionOperator>IsEquals</ExpressionOperator>
<Value>True</Value>
<Is64Bit>True</Is64Bit>
</DetectionClause>
</CustomDetectionMethods>
</DeploymentType>
</DeploymentTypes>
<Distribution>
<DistributeContent>True</DistributeContent>
</Distribution>
<Deployment>
<DeploySoftware>True</DeploySoftware>
</Deployment>
Pass a path to CMPackager.ps1 to look for recipes, extra files, and the preference file. This would allow people to manage their own recipes and preferences outside of this repo.
Use cases:
In general it might be a better idea to completely split out the recipes, but that is a much bigger undertaking.
Hi,
Line 376, your add-logcontent doesn't copy the $ApplicationIcon parameters in the log file
(not a big issue but that made my troubleshooting go in the wrong way)
Thanks for the script, nice work
Charchess
When skipping a download with $Download.Version, extracopyfunctions should probably also be skipped unless I am missing something.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.