{"id":19954022,"url":"https://github.com/mkht/dscr_application","last_synced_at":"2025-05-03T19:31:54.625Z","repository":{"id":57670443,"uuid":"92618757","full_name":"mkht/DSCR_Application","owner":"mkht","description":"PowerShell DSC Resource to Install / Uninstall Windows Desktop Applications.","archived":false,"fork":false,"pushed_at":"2022-09-15T04:46:48.000Z","size":87,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-18T13:20:47.408Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkht.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-27T19:10:37.000Z","updated_at":"2024-02-26T21:52:47.000Z","dependencies_parsed_at":"2022-09-16T05:03:17.020Z","dependency_job_id":null,"html_url":"https://github.com/mkht/DSCR_Application","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_Application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_Application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_Application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_Application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkht","download_url":"https://codeload.github.com/mkht/DSCR_Application/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252242046,"owners_count":21717096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T01:18:36.064Z","updated_at":"2025-05-03T19:31:54.357Z","avatar_url":"https://github.com/mkht.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"DSCR_Application\r\n====\r\n\r\nPowerShell DSC Resource to Install / Uninstall Windows Desktop Applications.\r\n\r\n## Install\r\nYou can install the resource from [PowerShell Gallery](https://www.powershellgallery.com/packages/DSCR_Application/).\r\n```Powershell\r\nInstall-Module -Name DSCR_Application\r\n```\r\n\r\n## Resources\r\n* **cApplication**\r\nDSC Resource to Install / Uninstall Windows Desktop Applications. It is easier to use and more flexible compared to the built-in \"Package\" resource.\r\n\r\n## Properties\r\n\r\nThere are many properties, but most are optional.\r\nYou can use this resource simply or flexibly. Please see the \"Examples\" section below.\r\n\r\n### cApplication\r\n+ **[string] Ensure** (Write):\r\n    + Specifies whether or not the application should be installed or not.\r\n    + The default value is `Present`. { Present | Absent }.\r\n\r\n+ **[string] Name** (key):\r\n    + The name of the application that should be installed or uninstalled. You can confirm an accurate name of the application from \"Programs and Features\" in the control panel.\r\n\r\n+ **[bool] Fuzzy** (Write):\r\n    + If specified this property as `$true`, you can use regular expressions in the `Name` property.\r\n    + The default value is `$false`.\r\n    + :warning: Be careful that the RegExp matches only one application.\r\n\r\n+ **[string] ProductId** (Write):\r\n    + The GUID of the application.\r\n    + This is the optional parameter. If this property is specified, the `Name` property will be ignored.\r\n\r\n+ **[string] Version** (Write):\r\n    + Indicates the expected version string of the application.\r\n    + When the property not specified, This resource simply tests whether the application is installed or not. But when specified, This also tests the installed version is match the expected one.\r\n\r\n+ **[bool] UseSemVer** (Write):\r\n    + If specified this property as `$true`, you can use a [node-semver like range syntax](https://github.com/npm/node-semver#ranges) for testing the version of the application.\r\n    + Please see the [usage examples](#examples).\r\n    + The default value is `$false`.\r\n    + If the `Version` property is not specified, this property will be ignored.\r\n\r\n+ **[string] InstalledCheckFilePath** (Write):\r\n    + The file path of the application should be created.\r\n    + If this property is specified, This resource judge whether the application is installed or not by whether the path exists or not.\r\n\r\n+ **[string] InstalledCheckScript** (Write):\r\n    + You can specify the PowerShell commands or ScriptBlock that for test whether the application is installed or not.\r\n    + ScriptBlock should return `$true` or `$false`\r\n\r\n+ **[string] InstallerPath** (Required):\r\n    + The path to the installer or uninstaller file.\r\n    + You can use Local file / UNC / http / https / ftp . (if specified http/https/ftp. the file will be downloaded to temp dir before installation)\r\n\r\n+ **[PSCredential] Credential** (Write):\r\n    + The credential for access to the installer on a remote source if needed.\r\n    + :warning: If you want to run the installation as specific user, you need to use `PsDscRunAsCredential` standard property.\r\n\r\n+ **[UInt32] ProcessTimeout** (Write):\r\n    + The timeout seconds of installation process.\r\n    + The default value is `2147483`. (`0` to `2147483`)\r\n\r\n+ **[UInt32] DownloadTimeout** (Write):\r\n    + The timeout seconds of download the installer from http/https/ftp.\r\n    + The default value is `900`. (`0` is infinite)\r\n\r\n+ **[string] FileHash** (Write):\r\n    + The expected hash value of the installer file at the given path.\r\n    + This is the optional parameter. Hash will be tested only when the param specified.\r\n\r\n+ **[string] HashAlgorithm** (Write):\r\n    + The algorithm used to generate the given hash value.\r\n    + The default value is `SHA256` { SHA1 | SHA256 | SHA384 | SHA512 | MD5 | RIPEMD160 }\r\n\r\n+ **[string] Arguments** (Write):\r\n    + The arguments to be passed to the installer during installation if needed.\r\n\r\n+ **[string] ArgumentsForUninstall** (Write):\r\n    + The arguments to be passed to the uninstaller during uninstallation if needed.\r\n\r\n+ **[string] WorkingDirectory** (Write):\r\n    + Sets the working directory for the process to be started.\r\n\r\n+ **[bool] UseUninstallString** (Write):\r\n    + If specified this property as `$true`, This resource will use the standard uninstall method that is registered in the registry value of \"UninstallString\" to uninstall programs.\r\n    + The default value is `$false`.\r\n    + If specified as `$true`, `InstallerPath` and `ArgumentsForUninstall` will be ignored.\r\n\r\n+ **[UInt32[]] ReturnCode** (Write):\r\n    + Indicates the expected return code. If the return code does not match the expected value, the configuration will return an error.\r\n    + The default value is `(0, 1641, 3010)`.\r\n\r\n+ **[bool] NoRestart** (Write):\r\n    + When this property as `$true`, This resource does not set `RebootNodeIfNeeded` to `$true` even if the system requires a reboot after installation.\r\n    + The default value is `$false`.\r\n\r\n+ **[string] PreAction** (Write):\r\n    + You can specify the PowerShell commands or ScriptBlock that will execute before installation or uninstallation.\r\n\r\n+ **[string] PostAction** (Write):\r\n    + You can specify the PowerShell commands or ScriptBlock that will execute after installation or uninstallation.\r\n\r\n+ **[string] PreCopyFrom** (Write):\r\n    + You can copy extra files before installation or uninstallation.\r\n    + Copied files will delete automatically after installation finished.\r\n\r\n+ **[string] PreCopyTo** (Write):\r\n    + The path of the directory which the file specified by `PreCopyFrom` is saved.\r\n\r\n+ **[string] LogLevel** (Write):\r\n    + Specifies the level of logging output to the Verbose stream.\r\n    + The default value is `All` { None | Minimal | Moderate | All }\r\n\r\n----\r\n## Examples\r\n+ **Example 1**: Install Visual Studio Code [Simple scenario]\r\n```Powershell\r\nConfiguration Example1\r\n{\r\n    Import-DscResource -ModuleName DSCR_Application\r\n    cApplication VSCode\r\n    {\r\n        Name = 'Microsoft Visual Studio Code'\r\n        InstallerPath = 'C:\\VSCodeSetup-1.12.2.exe'\r\n        Arguments = '/verysilent /mergeTasks=\"!runCode\"'\r\n    }\r\n}\r\n```\r\n\r\n+ **Example 2**: Install Latest version of Flash Player Plugin [Advanced scenario]\r\n```Powershell\r\nConfiguration Example2\r\n{\r\n    Import-DscResource -ModuleName DSCR_Application\r\n    cApplication FlashPlayer\r\n    {\r\n        Name = 'Adobe Flash Player \\d+ NPAPI'   # You can use RegExp when Fuzzy=$true\r\n        Fuzzy = $true\r\n        # Download installer from internet.\r\n        InstallerPath = \"http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player.exe\"\r\n        Arguments = '-install'\r\n    }\r\n}\r\n```\r\n\r\n+ **Example 3**: Install Firefox v53.0.3 to the custom directory [Complex scenario]\r\n```Powershell\r\nConfiguration Example3\r\n{\r\n    Import-DscResource -ModuleName DSCR_Application\r\n    cApplication Firefox53\r\n    {\r\n        Name = 'Mozilla Firefox [\\.\\d]+ \\(x64 en-US\\)' # Use RegExp\r\n        Fuzzy = $true\r\n        Version = '53.0.3'\r\n        InstallerPath = '\\\\FileServer\\Installer\\Firefox Setup 53.0.3.exe'\r\n        Credential = $Cred  # Credential for FileServer\r\n        Arguments = '/INI=C:\\config.ini'\r\n        PreAction = {\r\n                \"[Install]`r`nInstallDirectoryPath=`\"C:\\Firefox\\`\"\" | Out-File C:\\config.ini -Encoding Ascii\r\n            }   # Create config.ini before installation\r\n        PostAction = 'del C:\\config.ini -Force' # Remove config.ini after installation\r\n    }\r\n}\r\n```\r\n\r\n+ **Example 4**: Install the Microsoft Edge only if the machine don't have it or the version is less than 80.0. [How to use `USeSemVer` option]  \r\n```Powershell\r\nConfiguration Example4\r\n{\r\n    Import-DscResource -ModuleName DSCR_Application\r\n    cApplication MSEdge80+\r\n    {\r\n        Name = 'Microsoft Edge'\r\n        Version = '\u003e=80.0'  # This range expression indicates that version 80.0 or higher is desirable\r\n        UseSemVer = $true\r\n        InstallerPath = 'C:\\MicrosoftEdgeEnterpriseX64.msi'\r\n        Arguments = '/qn'\r\n    }\r\n}\r\n```\r\n\r\n---\r\n## ChangeLog\r\n### 4.1.1\r\n + Improve log messages.\r\n\r\n### 4.1.0\r\n + Add `LogLevel` property.\r\n\r\n### 4.0.2\r\n + `TimeoutSec` property is changed to `DownloadTimeout`.\r\n + Add `ProcessTimeout` property.\r\n + Return `1460` instead of an error when process timeout occurs.\r\n\r\n### 3.2.1\r\n + Improved the behavior when downloading files from network that behind of a proxy.\r\n\r\n### 3.2.0\r\n + Add `UseSemVer` property.  \r\n   You can test if the desired version of the application is installed using [node-semver like range syntax](https://github.com/npm/node-semver#ranges).\r\n\r\n### 3.1.2\r\n + Fixed: Error occurred after installation if the URL of a MSI installer is specified.\r\n\r\n### 3.1.1\r\n + Fixed: Test-TargetResource fails if there is an app that has some wildcard chars. [#8](https://github.com/mkht/DSCR_Application/issues/8)\r\n + Avoid positional parameters. [#10](https://github.com/mkht/DSCR_Application/issues/10)\r\n\r\n### 3.1.0\r\n + Enable TLS 1.2 when the file download from web. (only if it has not enabled)\r\n\r\n### 3.0.1\r\n + Revert the changes \"Changed to stop processing if multiple applications matching the search criteria.\" in `3.0.0`.\r\n   This changes happens an application error in some scenarios. \r\n\r\n### 3.0.0\r\n + Add `WorkingDirectory` property.\r\n + Changed to stop processing if multiple applications matching the search criteria.\r\n\r\n### 2.7.0\r\n + Improve error handling.\r\n\r\n### 2.6.0\r\n + Faster file download with http/https/ftp\r\n + Fixed an issue that the error occurred when a FTP URL is specified to InstallerPath.\r\n\r\n### 2.5.3\r\n + Fixed an issue that timeout error may occurred unexpectedly during installation.\r\n\r\n### 2.5.2\r\n + Correct the default value of `UseUninstallString` property to `$false`.\r\n + Add a sample configuration for uninstall.\r\n + Fix examples in the README.\r\n\r\n### 2.5.1\r\n + Fix PSSA issues.\r\n + Remove unnecessary files in the published data.\r\n\r\n### 2.5.0\r\n + Improve error handling\r\n + Add `InstalledCheckScript` property [#4](https://github.com/mkht/DSCR_Application/issues/4)\r\n\r\n### 2.4.1\r\n + Fix issue that An error may occur in an environment with only one installed application. [#3](https://github.com/mkht/DSCR_Application/issues/3)\r\n\r\n### 2.4.0\r\n + Add `InstalledCheckFilePath` property\r\n + Fix issue that some applications are judged as not installed even if it is installed.\r\n\r\n### 2.3.0\r\n + Fix failure of file download when `InstallerPath` is not a direct link [#1](https://github.com/mkht/DSCR_Application/issues/1)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkht%2Fdscr_application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkht%2Fdscr_application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkht%2Fdscr_application/lists"}