File tree Expand file tree Collapse file tree 4 files changed +34
-11
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Applications Expand file tree Collapse file tree 4 files changed +34
-11
lines changed Original file line number Diff line number Diff line change 11<ApplicationInfo xmlns : xsd =" http://www.w3.org/2001/XMLSchema" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" ToolVersion =" 1.8.3.0" >
2- <Name >Install .ps1</Name >
3- <UnencryptedContentSize >28319 </UnencryptedContentSize >
2+ <Name >install .ps1</Name >
3+ <UnencryptedContentSize >1154 </UnencryptedContentSize >
44 <FileName >IntunePackage.intunewin</FileName >
5- <SetupFile >Install .ps1</SetupFile >
5+ <SetupFile >install .ps1</SetupFile >
66 <EncryptionInfo >
7- <EncryptionKey >bmoyHXFtIws7JrnXNDV4rjzap+Be+4ZJEDJkTfbVIL8 =</EncryptionKey >
8- <MacKey >xNh8ZUZ6TLsAtihUEAU/NHiRfutDzz+eSgEdpaXUo9Q =</MacKey >
9- <InitializationVector >3aQFPhO8ywEC4Ojby1lR0w ==</InitializationVector >
10- <Mac >PXX+hj3DXEpzMEMYBDXmAIlSyDIGuAwmAHIQpZIt8hU =</Mac >
7+ <EncryptionKey >v8i9okyqxp8xlw3/r2QXMNnXcuGwrBkD54QQ7F/UJbc =</EncryptionKey >
8+ <MacKey >XjT9kWc7gQRKRdEQ/PA/lbQDDH8kFjnuPFILxAldRTI =</MacKey >
9+ <InitializationVector >iyAbM3kIYqA4AlWP89S5oA ==</InitializationVector >
10+ <Mac >w+2KMctRWmJzYjKcMTAKCLz15K559SgZ3pnQuQD3P/I =</Mac >
1111 <ProfileIdentifier >ProfileVersion1</ProfileIdentifier >
12- <FileDigest >fx41h3rGZYZO3Jux7JnPgatlmpMc2ZFIZS8ipF5VDDw =</FileDigest >
12+ <FileDigest >tyjBbJZ+Zj9AqD7UjEfQfe/HojN/q1+zFPidXWbiVuE =</FileDigest >
1313 <FileDigestAlgorithm >SHA256</FileDigestAlgorithm >
1414 </EncryptionInfo >
1515</ApplicationInfo >
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ param (
1212 [string ]
1313 $CustomRepo ,
1414
15+ [Parameter ()]
16+ [string ]
17+ $CustomArguments ,
18+
1519 [Parameter ()]
1620 [switch ]
1721 $Trace
@@ -36,13 +40,23 @@ try {
3640 try {
3741 $localprograms = & " $chocoPath " list -- localonly
3842 $CustomRepoString = if ($CustomRepo ) { " --source $customrepo " } else { $null }
43+ $CustomArgsArray = if ($CustomArguments ) { $CustomArguments -split ' \s+' } else { @ () }
44+
3945 if ($localprograms -like " *$Packagename *" ) {
4046 Write-Host " Upgrading $packagename "
41- & " $chocoPath " upgrade $Packagename $CustomRepoString
47+ if ($CustomArgsArray.Count -gt 0 ) {
48+ & " $chocoPath " upgrade $Packagename $CustomRepoString $CustomArgsArray
49+ } else {
50+ & " $chocoPath " upgrade $Packagename $CustomRepoString
51+ }
4252 }
4353 else {
4454 Write-Host " Installing $packagename "
45- & " $chocoPath " install $Packagename - y $CustomRepoString
55+ if ($CustomArgsArray.Count -gt 0 ) {
56+ & " $chocoPath " install $Packagename - y $CustomRepoString $CustomArgsArray
57+ } else {
58+ & " $chocoPath " install $Packagename - y $CustomRepoString
59+ }
4660 }
4761 Write-Host ' Completed.'
4862 }
Original file line number Diff line number Diff line change @@ -25,19 +25,28 @@ Function Invoke-AddChocoApp {
2525 if ($ChocoApp.customrepo ) {
2626 $intuneBody.installCommandLine = $intuneBody.installCommandLine + " -CustomRepo $ ( $ChocoApp.CustomRepo ) "
2727 }
28+ if ($ChocoApp.customArguments ) {
29+ $intuneBody.installCommandLine = $intuneBody.installCommandLine + " -CustomArguments '$ ( $ChocoApp.customArguments ) '"
30+ }
2831 $intuneBody.UninstallCommandLine = " powershell.exe -ExecutionPolicy Bypass .\Uninstall.ps1 -Packagename $ ( $ChocoApp.PackageName ) "
2932 $intuneBody.detectionRules [0 ].path = " $ ( $ENV: SystemDrive ) \programdata\chocolatey\lib"
3033 $intuneBody.detectionRules [0 ].fileOrFolderName = " $ ( $ChocoApp.PackageName ) "
3134
3235 $Tenants = $Request.Body.selectedTenants.defaultDomainName
3336 $Results = foreach ($Tenant in $Tenants ) {
3437 try {
38+ # Apply CIPP text replacement for tenant-specific variables
39+ $TenantIntuneBody = $intuneBody | ConvertTo-Json - Depth 15 | ConvertFrom-Json
40+ if ($TenantIntuneBody.installCommandLine -match ' %' ) {
41+ $TenantIntuneBody.installCommandLine = Get-CIPPTextReplacement - TenantFilter $Tenant - Text $TenantIntuneBody.installCommandLine
42+ }
43+
3544 $CompleteObject = [PSCustomObject ]@ {
3645 tenant = $Tenant
3746 ApplicationName = $ChocoApp.ApplicationName
3847 assignTo = $AssignTo
3948 InstallationIntent = $Request.Body.InstallationIntent
40- IntuneBody = $intuneBody
49+ IntuneBody = $TenantIntuneBody
4150 } | ConvertTo-Json - Depth 15
4251 $Table = Get-CippTable - tablename ' apps'
4352 $Table.Force = $true
You can’t perform that action at this time.
0 commit comments