Skip to content

Commit

Permalink
docs: Improved documentation to show cross platform commands
Browse files Browse the repository at this point in the history
  • Loading branch information
svrooij committed Jan 2, 2024
1 parent f60d97d commit fda15ab
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 29 deletions.
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ Take any (just msi installers for now) app from winget and upload it to Intune i
- 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 also a [beta application](#beta-application), so please report any issues you find.
A lot of commands run the `winget` command, so make sure you have the [App Installer](https://www.microsoft.com/p/app-installer/9nblggh4nns1) installed on your computer as well.
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.

This application used to be Windows only, but recently the main functionality is ported to other platforms by reducing the [platform dependencies](https://svrooij.io/2023/10/24/create-intunewin-file/). This means that the `package` and `publish` commands should work on any platform that supports dotnet 7. The `msi` command is still windows only, as it uses the `Microsoft.Deployment.WindowsInstaller` package. Both the `package` and `publish` won't support other sources than `winget`, and will use my [open-source winget index](https://github.com/svrooij/winget-pkgs-index/), instead of running winget to get the required information.

[![LinkedIn Profile][badge_linkedin]][link_linkedin]
[![Link Mastodon][badge_mastodon]][link_mastodon]
Expand Down Expand Up @@ -51,7 +53,7 @@ The CLI has several commands, try them out yourself.

```Shell
Description:
Enhanced Winget CLI for automations
winget-intune by @svrooij allows you to package any winget app for Intune

Usage:
winget-intune [command] [options]
Expand All @@ -61,13 +63,14 @@ Options:
-?, -h, --help Show help and usage information

Commands:
install <packageId> Installs or upgrades a package
check <packageId> Check if a specific version in installed
info <packageId> Show package info as json
package <packageId> Package an app for Intune
publish <packageId> Publish an packaged app to Intune
msi <msiFile> Extract info from MSI file
about Information about this package and it's author
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
Expand All @@ -83,7 +86,9 @@ winget-intune package {PackageId} [--version {version}] [--source winget] --pack
> 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://github.com/svrooij/winget-pkgs-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.
Previously it used the closed source [content-prep-tool](https://github.com/Microsoft/Microsoft-Win32-Content-Prep-Tool) to generate the `intunewin` file, this has since been replaced with my own faster, open-souce and cross-platform [implementation](https://github.com/Svrooij/ContentPrep).

The packaging command uses an open-source & cross-platform [implementation](https://github.com/Svrooij/ContentPrep) 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
Expand All @@ -107,11 +112,11 @@ You can also assign the app to a group, and set the categories.
winget-intune 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 "all-users" to make the app available to all users
# 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 from the group, use --uninstall
winget-intune publish {PackageId}... --available "3bac8336-623f-46bf-bcab-b5c61e3e5b7a" --available "all-users"
winget-intune publish {PackageId}... --available "3bac8336-623f-46bf-bcab-b5c61e3e5b7a" --available "all-users"
# Or if you want to remove the app for that group, use --uninstall
winget-intune publish {PackageId}... --required "3bac8336-623f-46bf-bcab-b5c61e3e5b7a" --required "allusers"
winget-intune publish {PackageId}... --uninstall "3bac8336-623f-46bf-bcab-b5c61e3e5b7a" --uninstall "allusers"
```

#### Auto-package
Expand All @@ -132,8 +137,10 @@ If you want to contribute to this project, please check out the [contributing](h

## Usefull information

- [Microsoft-Win32-Content-Prep-Tool](https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool)
- [Blog articles on Intune](https://svrooij.io/tags/intune/)
- Open-source [winget index](https://github.com/svrooij/winget-pkgs-index/)
- Open-source [PowerShell Content Prep](https://github.com/svrooij/contentprep)
- Closed source [Microsoft Win32 Content Prep tool](https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool)

[badge_blog]: https://img.shields.io/badge/blog-svrooij.io-blue?style=for-the-badge
[badge_linkedin]: https://img.shields.io/badge/LinkedIn-stephanvanrooij-blue?style=for-the-badge&logo=linkedin
Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/Commands/AboutCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace WingetIntune.Commands;
internal class AboutCommand : Command
{
private const string name = "about";
private const string description = "Information about this package and it's author";
private const string description = "Information about this package and it's author (cross platform)";

public AboutCommand() : base(name, description)
{
Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/Commands/CheckCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace WingetIntune.Commands;
internal class CheckCommand : Command
{
private const string name = "check";
private const string description = "Check if a specific version in installed";
private const string description = "Check if a specific version in installed (Windows-only)";

public CheckCommand() : base(name, description)
{
Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/Commands/GenerateIndexCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace WingetIntune.Commands;
internal class GenerateIndexCommand : Command
{
private const string name = "generate-index";
private const string description = "(hidden) Generates the index.json file for the repository";
private const string description = "(hidden) Generates the index.json file for the repository (cross platform)";
public GenerateIndexCommand() : base(name, description)
{
IsHidden = true;
Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/Commands/InfoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace WingetIntune.Commands;
internal class InfoCommand : Command
{
private const string name = "info";
private const string description = "Show package info as json";
private const string description = "Show package info as json (Windows-only)";

public InfoCommand() : base(name, description)
{
Expand Down
3 changes: 1 addition & 2 deletions src/WingetIntune.Cli/Commands/InstallOrUpgradeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace WingetIntune.Commands
internal class InstallOrUpgradeCommand : Command
{
private const string name = "install";
private const string description = "Installs or upgrades a package";
private const string description = "Installs or upgrades a package (Windows-only)";

public InstallOrUpgradeCommand() : base(name, description)
{
Expand All @@ -36,7 +36,6 @@ public InstallOrUpgradeCommand() : base(name, description)
//AddOption(new Option<string>(new string[] { "--accept-package-matching", "-p" }, "Accept package matching"));
//AddOption(new Option<string>(new string[] { "--accept-package-modified", "-u" }, "Accept package modified"));
//AddOption(new Option<string>(new string[] { "--accept-package"}))

this.Handler = CommandHandler.Create(HandleCommand);
}

Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/Commands/MsiCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace WingetIntune.Commands;
internal class MsiCommand : Command
{
private const string name = "msi";
private const string description = "Extract info from MSI file";
private const string description = "Extract info from MSI file (Windows-only)";

private Argument<string> msiFileArgument = new Argument<string>("msiFile", "Path to MSI file");

Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/Commands/PackageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace WingetIntune.Commands;
internal class PackageCommand : Command
{
private const string name = "package";
private const string description = "Package an app for Intune";
private const string description = "Package an app for Intune (cross platform)";

internal static readonly Option<string> TempFolderOption = new Option<string>("--temp-folder", () => Path.Combine(Path.GetTempPath(), "intunewin"), "Folder to store temporaty files")
{
Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/Commands/PublishCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace WingetIntune.Commands;
internal class PublishCommand : Command
{
private const string name = "publish";
private const string description = "Publish a packaged app to Intune";
private const string description = "Publish a packaged app to Intune (cross platform)";

internal static readonly Option<string?> TenantOption = new Option<string?>("--tenant", "Tenant ID to use for authentication");
internal static readonly Option<string?> UsernameOption = new Option<string?>("--username", "Username to use for authentication");
Expand Down
10 changes: 7 additions & 3 deletions src/WingetIntune.Cli/Commands/WinGetRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ internal class WinGetRootCommand : RootCommand

public WinGetRootCommand()
{
Description = "Enhanced Winget CLI for automations";
Description = "winget-intune by @svrooij allows you to package any winget app for Intune";
// Cross platform commands
AddCommand(new PackageCommand());
AddCommand(new PublishCommand());
AddCommand(new AboutCommand());
AddCommand(new GenerateIndexCommand());

// Windows only command
AddCommand(new InstallOrUpgradeCommand());
AddCommand(new CheckCommand());
AddCommand(new InfoCommand());
AddCommand(new MsiCommand());
AddCommand(new AboutCommand());
AddCommand(new GenerateIndexCommand());

Check failure on line 31 in src/WingetIntune.Cli/Commands/WinGetRootCommand.cs

View workflow job for this annotation

GitHub Actions / 🛠️ Build and Test

Fix whitespace formatting. Replace 26 characters with '\r\n\s\s\s\s\s\s\s\s'. [/home/runner/work/WingetIntune/WingetIntune/src/WingetIntune.Cli/WingetIntune.Cli.csproj]
AddGlobalOption(VerboseOption);
AddGlobalOption(JsonOption);
}
Expand Down

0 comments on commit fda15ab

Please sign in to comment.