aaronparker / packagefactory

A packaging factory for Microsoft Intune using Evergreen, VcRedist, and IntuneWin32App
https://stealthpuppy.com/packagefactory/
MIT License
63 stars 18 forks source link

Question: simple powershell script #35

Closed JorgaWetzel closed 1 year ago

JorgaWetzel commented 1 year ago

Your script is just awesome, thank you very much. I like to use it very much, but I don't always have to distribute a package with an EXE or an MSI. I like to use chococlatey, or just want to distribute a regsitry value. Is there a way to distribute a simple install.ps1 and a detection.ps1 in your script?

as an example install.ps1:

$ProgramName = "PDF24"

$ChocoPrg_Version = [System.Version](C:\ProgramData\chocolatey\choco.exe --version) if ($ChocoPrg_Version -gt [System.Version]"2.0") { $localprograms = C:\ProgramData\chocolatey\choco.exe list } else { $localprograms = C:\ProgramData\chocolatey\choco.exe list -lo }

if ($localprograms -like "$ProgramName") { C:\ProgramData\chocolatey\choco.exe upgrade $ProgramName -y } else { C:\ProgramData\chocolatey\choco.exe install $ProgramName -y }

and the uninstall.ps1:

$ProgramName = "PDF24"

$ChocoPrg_Version = [System.Version](C:\ProgramData\chocolatey\choco.exe --version) if ($ChocoPrg_Version -gt [System.Version]"2.0") { $ChocoPrg_Existing = C:\ProgramData\chocolatey\choco.exe list } else { $ChocoPrg_Existing = C:\ProgramData\chocolatey\choco.exe list -lo }

if ($ChocoPrg_Existing -like "$ProgramName") { Write-Host "Found it!" exit 0 } else { exit 1 }

JorgaWetzel commented 1 year ago

I found a way to do it.

aaronparker commented 1 year ago

There's also an example here: https://github.com/aaronparker/packagefactory/tree/main/packages/App/LogAnalyticsSecrets