Skip to content

Commit

Permalink
feat: Override name on Deploy (#45)
Browse files Browse the repository at this point in the history
As suggested in #43
  • Loading branch information
svrooij authored Apr 9, 2024
1 parent bc54c7a commit e59d3fb
Show file tree
Hide file tree
Showing 17 changed files with 237 additions and 217 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Bug Report
description: File a bug report
title: "[Bug]: Command failed..."
labels: ["bug", "triage"]
name: Bug Report CLI
description: File a bug for WinTuner CLI
title: "[Bug]: CLI ..."
labels: ["bug", "triage", "CLI"]
assignees:
- svrooij
body:
Expand All @@ -27,6 +27,7 @@ body:
- check
- info
- msi
- other
validations:
required: true

Expand All @@ -52,7 +53,7 @@ body:
id: what_happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen? Your explaination only
description: Also tell us, what did you expect to happen? Your explanation only
placeholder: Tell us what you see!
validations:
required: true
Expand Down
89 changes: 89 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-ps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Bug Report PowerShell
description: File a bug report for WinTuner PowerShell
title: "[Bug]: PowerShell ..."
labels: ["bug", "triage", "PowerShell"]
assignees:
- svrooij
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Duplicate issues will be closed, please [🔍 search issues](https://github.com/svrooij/WingetIntune/issues) before creating a new one.
This form is for bugs only, you can a questions in the [Q&A section ❔](https://github.com/svrooij/WingetIntune/discussions/categories/q-a). And new features are discussed in the [Ideas section 💡](https://github.com/svrooij/WingetIntune/discussions/categories/ideas).
This app gets updates pretty regularly, have you checked you're running the latest version?
[WinTuner](https://www.powershellgallery.com/packages/WinTuner/) is only supported on `PowerShell 7.4` and up, so you cannot install it on Windows PowerShell.
- type: dropdown
id: cmd
attributes:
label: CommandLet
description: Which command did you run?
options:
- New-WtWingetPackage
- Deploy-WtWin32App
- Get-WtWin32Apps
- Remove-WtWin32App
- New-IntuneWinPackage
- Unprotect-IntuneWinPackage
- other
validations:
required: true

- type: input
id: command
attributes:
label: Full command
description: Show us the full command (mask sensitive data)
placeholder: Deploy-WtWin32App -PackageFolder "{packageFolder}" -UseDefaultCredentials $true
validations:
required: true

- type: input
id: version
attributes:
label: Module version
description: "Execute `Get-Installedmodule -Name WinTuner`"
placeholder: "0.8.2"
validations:
required: true

- type: textarea
id: what_happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen? Your explanation only
placeholder: Tell us what you see!
validations:
required: true

- type: textarea
id: logs
attributes:
label: Command output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: PowerShell

- type: input
id: ps
attributes:
label: PowerShell version
description: Things might be different in other versions of PowerShell
placeholder: "7.4.1"
validations:
required: true

- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/svrooij/WingetIntune/blob/main/CODE_OF_CONDUCT.txt). This is an open-source project, don't demand support, I'll do my best. And if you really like the project, check out [Github Sponsors](https://github.com/sponsors/svrooij)
options:
- label: "I agree to follow this project's Code of Conduct"
required: true
- label: "I won't demand an immediate answer"
required: true

3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ contact_links:
- name: Feature requests
url: https://github.com/svrooij/WingetIntune/discussions/categories/ideas
about: Discuss new ideas, improvements and feature requests
- name: Documentation
url: https://wintuner.app
about: Documentation for WinTuner
- name: Blog
url: https://svrooij.io
about: Check my blog for more interesting posts
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,6 @@ FodyWeavers.xsd

# Build artifacts
dist

# LUT config file from Visual Studio
*.lutconfig
112 changes: 23 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
# WinTuner CLI
# WinTuner

[![GitHub issues](https://img.shields.io/github/issues/svrooij/wingetintune?style=for-the-badge)](https://github.com/svrooij/WingetIntune/issues)
[![Github sponsors](https://img.shields.io/github/sponsors/svrooij?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sponsors/svrooij)

[Documentation](https://wintuner.app/)

Take any (just msi installers for now) app from winget and upload it to Intune in minutes.
Take any app from WinGet and upload it to Intune in minutes. This app is available as [PowerShell module](#wintuner-powershell-module) and as a [CLI](#wintuner-cli), both run mostly thee same code.

- Downloading the installer and the logo
- Creating an `intunewin` file automatically
- Generating the needed script information
- Publish the app to Intune.

This application ~~is **Windows only** and~~ requires **Dotnet 7** to be installed on your computer. It's a [beta application](#beta-application), so please report any issues you find.
Some commands run the `winget` in the background and are thus Windows-only, make sure you have the [App Installer](https://www.microsoft.com/p/app-installer/9nblggh4nns1) installed on your computer if you want to use these commands.

The `package` and `publish` commands are cross-platform, and should work on any platform that supports dotnet 7. These commands no longer use the winget executable, which also means any other sources than `winget` are no longer supported.
The `msi` command is still windows only, as it uses the `Microsoft.Deployment.WindowsInstaller` package.

[![LinkedIn Profile][badge_linkedin]][link_linkedin]
[![Link Mastodon][badge_mastodon]][link_mastodon]
[![Follow on Twitter][badge_twitter]][link_twitter]
[![Check my blog][badge_blog]][link_blog]

## Installing
## WinTuner PowerShell Module

This is the PowerShell version of the WinTuner application, requiring PowerShell `7.4` (net8.0). Available in the [PowerShell Gallery](https://www.powershellgallery.com/packages/WinTuner/). Documentation can be found [here](https://wintuner.app/docs/category/wintuner-powershell).

```PowerShell
Install-Module -Name WinTuner
```

As of April 2024, the main development focus will be on the PowerShell module, since that is what most sysadmin use. The CLI will still be maintained, but will not get new features as fast as the PowerShell module.

## WinTuner CLI

This application ~~is Windows only and~~ requires **Dotnet 8** to be installed on your computer. It's a [beta application](#beta-application), so please report any issues you find.
Some commands run the `winget` in the background and are thus Windows-only, make sure you have the [App Installer](https://www.microsoft.com/p/app-installer/9nblggh4nns1) installed on your computer if you want to use these commands.

The `package` and `publish` commands are cross-platform, and should work on any platform that supports dotnet 8. These commands no longer use the WinGet executable, which also means any other sources than `winget` are no longer supported.
The `msi` command is still windows only, as it uses the `Microsoft.Deployment.WindowsInstaller` package.

Check out the [documentation](https://wintuner.app/docs/category/wintuner-cli) for more information.

### Installing

This package can be downloaded as a dotnet tool. Make sure you have Dotnet 8 installed on your computer.
I'm working to get a code signing certificate, but for now you might have to configure an exception on your computer to run unsigned code.
Expand All @@ -48,86 +62,6 @@ dotnet tool update --global SvRooij.Winget-Intune.Cli
This is a beta application, it's not yet ready for production use. I'm still working on it, and I'm looking for feedback.
If you found a bug please create an [issue](https://github.com/svrooij/WingetIntune/issues/new/choose), if you have questions or want to share your feedback, check out the [discussions](https://github.com/svrooij/WingetIntune/discussions) page.

## Commands

The CLI has several commands, try them out yourself.

```Shell
Description:
wintuner by @svrooij allows you to package any winget app for Intune

Usage:
wintuner [command] [options]

Options:
--version Show version information
-?, -h, --help Show help and usage information

Commands:
package <packageId> Package an app for Intune (cross platform)
publish <packageId> Publish a packaged app to Intune (cross platform)
about Information about this package and it's author (cross platform)
install <packageId> Installs or upgrades a package (Windows-only)
check <packageId> Check if a specific version in installed (Windows-only)
info <packageId> Show package info as json (Windows-only)
msi <msiFile> Extract info from MSI file (Windows-only)
```
### Package
You should definitely try the `package` command. as it's the most important one. Package an app from winget as an `intunewin` file, ready for uploading to intune.
You can also expect a `detection.ps1` file, that you should configure to be used as detection script in Intune, provided it's not a MSI installer, in that case you can find the detection information in the readme.
It will also write a `app.json` file with all the information about the app, for automation purposes.
```Shell
wintuner package {PackageId} [--version {version}] [--source winget] --package-folder {PackageFolder}
```
> The `packageId` ~~is case sensitive, so make sure you use the correct casing~~ will be matches against any package in the open source [index](https://wintuner.app/docs/related/winget-package-index). Tip: Copy it from the result of the `winget search {name}` command.
Upon downloading the installer, the SHA256 hash is checked against the one in the `winget` manifest, to make sure you won't package a tampered installer.

The packaging command uses an open-source & cross-platform [implementation](https://wintuner.app/docs/related/content-prep-tool) of the Windows-only & closed source [content-prep-tool](https://github.com/Microsoft/Microsoft-Win32-Content-Prep-Tool), to allow cross-platform building of the packages.
This new implementation is available as a dotnet library and a PowerShell module, so if you're into Intune packaging, check it out.
### Publish
The `publish` command will upload the `intunewin` file to Intune. You'll need to run the [package](#package) command first.
Not all packages will work for publishing, you can always try to manually upload the `intunewin` file to [Intune](https://endpoint.microsoft.com/#view/Microsoft_Intune_DeviceSettings/AppsWindowsMenu/~/windowsApps).

```Shell
# This app uses the built-in windows authentication, this will trigger a login prompt (or do sso).
wintuner publish {PackageId} --package-folder {PackageFolder} --tenant {TenantId} --username {Username}
# You can also provide a token, this is useful for automation.
wintuner publish {PackageId} --package-folder {PackageFolder} --token {Token}
```

#### Assignement and categories

You can also assign the app to a group, and set the categories.

```Shell
# Add --category "Productivity" --category "Utilities" to the command to set the categories (use the exact name!)
wintuner publish {PackageId} ... --category "Productivity" --category "Utilities"
# Add --available "group-guid" to make the app available to a group (use the guid of the group)
# Add --available "allusers" to make the app available to all users
# Instead of --available you can also use --required to make the app required for the group
# Or if you want to remove the app for that group, use --uninstall
wintuner publish {PackageId}... --required "3bac8336-623f-46bf-bcab-b5c61e3e5b7a" --required "allusers"
wintuner publish {PackageId}... --uninstall "3bac8336-623f-46bf-bcab-b5c61e3e5b7a" --uninstall "allusers"
```

#### Auto-package

You can also combine the `package` and `publish` command into one command, this will package the app and publish it to Intune. But this makes debugging harder, so when submitting issues, please don't use this option.
```Shell
wintuner publish {PackageId}... --auto-package
```
## Library (soon)

I'm planning to release the actual intune specific code as a separate library, so you can use it in your own projects. This will be released as a separate package.
Expand Down
6 changes: 0 additions & 6 deletions WingetIntune.lutconfig

This file was deleted.

90 changes: 0 additions & 90 deletions graph-apps.http

This file was deleted.

Empty file removed http-requests/test.txt
Empty file.
11 changes: 11 additions & 0 deletions src/Svrooij.WinTuner.CmdLets/Commands/DeployWtWin32App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ public class DeployWtWin32App : BaseIntuneCmdlet
HelpMessage = "The folder where the package is")]
public string? PackageFolder { get; set; }

/// <summary>
/// Override the name of the app in Intune
/// </summary>
[Parameter(HelpMessage = "Override the name of the app in Intune", Mandatory = false)]
public string? OverrideAppName { get; set; }

/// <summary>
/// <para type="description">The graph id of the app to supersede</para>
/// </summary>
Expand Down Expand Up @@ -154,6 +160,11 @@ public override async Task ProcessRecordAsync(CancellationToken cancellationToke
}
}

if (!string.IsNullOrEmpty(OverrideAppName))
{
App.DisplayName = OverrideAppName;
}

logger?.LogInformation("Uploading Win32App {DisplayName} to Intune with file {IntuneWinFile}", App!.DisplayName, IntuneWinFile);
var graphServiceClient = CreateGraphServiceClient(httpClient!);
var newApp = await graphAppUploader!.CreateNewAppAsync(graphServiceClient, App, IntuneWinFile!, LogoPath, cancellationToken);
Expand Down
Loading

0 comments on commit e59d3fb

Please sign in to comment.