Skip to content

Instantly share code, notes, and snippets.

@pinecones-sx
Created June 5, 2019 03:16
Show Gist options
  • Save pinecones-sx/4f6aa6a6afe2072b0b70b7d4dbc2276f to your computer and use it in GitHub Desktop.
Save pinecones-sx/4f6aa6a6afe2072b0b70b7d4dbc2276f to your computer and use it in GitHub Desktop.
to get icons from appx package
$results = (
Get-AppxPackage |
ForEach{
$thisAppx = $_
$thisManifest = $_ | Get-AppxPackageManifest
$thisSubPath = ''
$thisLogoBaseName = ''
$thisLogoRoot = ''
$thisLogoUNC = ''
If ($thisManifest.Package.Properties.logo -like '*\*'){
$thisSubPath = $thisManifest.Package.Properties.logo -replace '(.*\\).*','$1'
$thisLogoBaseName = $thisManifest.Package.Properties.logo -replace '.*\\' -replace '\..*'
$thisLogoRoot = Join-Path $thisAppx.InstallLocation $thisSubPath
# need logic to search for multiple files
$thisLogoUNC = Join-Path $thisLogoRoot ($thisLogoBaseName + '.scale-100' + '.PNG')
}
[pscustomobject]@{
Name = $thisManifest.Package.Applications.Application.Id
AppxName = $thisAppx.Name
RootDirectory = $thisAppx.InstallLocation
DisplayName = $thisManifest.Package.Applications.Application.VisualElements.DisplayName
LogoRoot = $thisLogoRoot
LogoUNC = $thisLogoUNC
LogoBaseName = $thisLogoBaseName
}
Remove-Item variable:\thisAppxName
Remove-Item Variable:\thisManifest
Remove-Item Variable:\thisLogoRoot
Remove-Item Variable:\thisSubPath
Remove-Item Variable:\thisLogoBaseName
Remove-Item Variable:\thisLogoUNC
}
)
$results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment