{"id":13624040,"url":"https://github.com/markkerry/MSIPatches","last_synced_at":"2025-04-15T20:33:07.120Z","repository":{"id":110380180,"uuid":"117815696","full_name":"markkerry/MSIPatches","owner":"markkerry","description":"Detect and move orphaned patches from \"C:\\Windows\\Installer\" using this PowerShell module","archived":false,"fork":false,"pushed_at":"2018-03-07T16:44:55.000Z","size":335,"stargazers_count":17,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-08T12:42:51.529Z","etag":null,"topics":["cleanup","disk-space","msi","msp","patches"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markkerry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE/LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-01-17T09:39:04.000Z","updated_at":"2024-09-19T03:16:22.000Z","dependencies_parsed_at":"2023-04-13T03:05:20.071Z","dependency_job_id":null,"html_url":"https://github.com/markkerry/MSIPatches","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markkerry%2FMSIPatches","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markkerry%2FMSIPatches/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markkerry%2FMSIPatches/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markkerry%2FMSIPatches/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markkerry","download_url":"https://codeload.github.com/markkerry/MSIPatches/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249148281,"owners_count":21220509,"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":["cleanup","disk-space","msi","msp","patches"],"created_at":"2024-08-01T21:01:38.119Z","updated_at":"2025-04-15T20:33:06.767Z","avatar_url":"https://github.com/markkerry.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# MSIPatches\r\n\r\n[![Build status](https://ci.appveyor.com/api/projects/status/mh290e295fnap311/branch/master?svg=true)](https://ci.appveyor.com/project/markkerry/msipatches/branch/master)\r\n[![PowerShell Gallery - MSIPatches](https://img.shields.io/badge/PowerShell%20Gallery-MSIPatches-ff69b4.svg)](https://www.powershellgallery.com/packages/MSIPatches/1.0.20)\r\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/markkerry/MSIPatches/blob/master/LICENSE)\r\n[![Minimum Supported PowerShell Version](https://img.shields.io/badge/PowerShell-3.0-blue.svg)](https://github.com/markkerry/MSIPatches)\r\n\r\n## About\r\n\r\nThe \"C:\\Windows\\Installer\" can often grow very large in size due to applications such as Microsoft Office being regularly patched. Superseded patches get left behind leaving them in an orphaned state. The MSIPatches module can detect and move the orphaned patches freeing up valuable disk space.\r\nThis module requires the [MSI](https://github.com/heaths/psmsi) module by [Heath Stewart](https://github.com/heaths). Installation instructions are in the next section\r\n\r\n**MSIPactches** functions\r\n**Get-MsiPatch.ps1**\r\n\r\n* Lists all msp files in `$env:SystemRoot\\Installer\\`\r\n* Calculates their total size\r\n* Gets installed patches and size\r\n* Gets orphaned patches and size\r\n\r\n**Get-OrphanedPatch.ps1**\r\n* Lists all orphaned patches in `$env:SystemRoot\\Installer\\`\r\n* Outputs the objects as `[System.IO.FileInfo]` which can be piped to the next functions.\r\n\r\n**Move-OrphanedPatch.ps1**\r\n* Moves all orphaned patches in `$env:SystemRoot\\Installer\\` to a specified location.\r\n\r\n**Restore-OrphanedPatch.ps1**\r\n* Restores all previously backed up orphaned patches to `$env:SystemRoot\\Installer\\`\r\n\r\n---\r\n\r\n## Installation\r\n\r\nYou can now install this module from the PowerShell gallery\r\n\r\n``` powershell\r\nInstall-Module MSIPatches\r\n```\r\n\r\nOr you can install it manually\r\n\r\n``` powershell\r\n# Install the MSI package\r\nInstall-Package msi -Provider PowerShellGet\r\n\r\n# Download and unzip the MSIPatches module.\r\n# Unblock the files. E.g:\r\nGet-ChildItem C:\\MSIPatches\\ -Recurse | Unblock-File\r\n\r\n# Import the module\r\nImport-Module C:\\MSIPatches\\MSIPatches.psd1 -Force -Verbose\r\n\r\n# List the commands in the MSIPatches module\r\nGet-Command -Module MSIPatches\r\n\r\nCommandType     Name                        Version    Source\r\n-----------     ----                        -------    ------\r\nFunction        Get-MsiPatch                1.0.21     MSIPatches\r\nFunction        Get-OrphanedPatch           1.0.21     MSIPatches\r\nFunction        Move-OrphanedPatch          1.0.21     MSIPatches\r\nFunction        Restore-OrphanedPatch       1.0.21     MSIPatches\r\n\r\n# Get-Help\r\nGet-Help about_MSIPatches\r\nGet-Help Get-MsiPatches\r\n```\r\n\r\n---\r\n\r\n## Examples\r\n\r\n``` powershell\r\n# Get a count of all MSI patches with Get-MsiPatch\r\nGet-MsiPatch\r\n```\r\n\r\n![Get-MsiPatch](/Media/Get-MsiPatch_01.png)  \r\n\r\n``` powershell\r\n# Get-OrphanedPatch returns basic information. [System.IO.FileInfo] objects.\r\nGet-OrphanedPatch\r\n```\r\n\r\n![Get-OrphanedPatch](/Media/Get-OrphanedPatch_01.png)\r\n\r\n``` powershell\r\n# Pass the [System.IO.FileInfo] objects through the pipeline to Move-OrphanedPatch\r\nGet-OrphanedPatch | Move-OrphanedPatch -Destination C:\\Backup\r\n```\r\n\r\n![Move-OrphanedPatch](/Media/Move-OrphanedPatch_01.png)\r\n\r\n``` powershell\r\n# 'y' to create the directory if it doesn't exist.\r\n```\r\n\r\n![Move-OrphanedPatch](/Media/Move-OrphanedPatch_02.png)\r\n\r\n``` powershell\r\n# After you move the orphaned patches you can run the Get-MsiPatch command again and see the results.\r\n```\r\n\r\n![Move-OrphanedPatch](/Media/Move-OrphanedPatch_03.png)\r\n\r\n``` powershell\r\n# Restore previously backed up msp files using the Restore-OrphanedPatch command\r\n Restore-OrphanedPatch -BackupLocation \u003cString\u003e\r\n```\r\n\r\n![Restore-OrphanedPatch](/Media/Restore-OrphanedPatch_01.png)\r\n\r\n``` powershell\r\n# If the directory doesn't exist/inaccessible or doesn't contain any msp files, the following will display\r\n```\r\n\r\n![Restore-OrphanedPatch](/Media/Restore-OrphanedPatch_02.png)  \r\n![Restore-OrphanedPatch](/Media/Restore-OrphanedPatch_03.png)\r\n\r\n``` powershell\r\n# Note: you can pass the [System.IO.FileInfo] objects through the pipeline to Remove-Item to permanenlty \r\n#delete the msp files. Recommend you pipe to Move-OrphanedPatch instead.\r\nGet-OrphanedPatch | Remove-Item\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkkerry%2FMSIPatches","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkkerry%2FMSIPatches","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkkerry%2FMSIPatches/lists"}