Advertisement
alcaron

AppV-IconCollector.ps1

Nov 27th, 2013
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #########################################################
  2. #
  3. #   Author: Paul Fulbright
  4. #   Date: 11/27/2013
  5. #   Filename: AppV-IconCollector.ps1
  6. #
  7. #########################################################
  8.  
  9. # Setup paths and create output folder if needed.
  10. $location = "C:\ProgramData\App-V"
  11. $destination = ("C:\Users\{0}\Desktop\IconTest" -f $env:USERNAME)
  12. if((Test-Path $destination) -ne $true){ New-Item -Path $destination -ItemType Directory -Force }
  13. $folders = Get-ChildItem -Path $location
  14.  
  15. # Find all App-V app folders.
  16. foreach($folder in $folders) {
  17.     # Import XML and get app name.
  18.     [xml]$manifest = Get-Content -Path (Get-ChildItem -Path $folder.FullName -Recurse | Where-Object{ $_.Name -eq "AppxManifest.xml" }).FullName.ToString()
  19.     $manifest.Package.Properties.Displayname
  20.     # Set output path, create if need be.
  21.     $iconPath = ("{0}\{1}" -f $destination,$manifest.Package.Properties.DisplayName)
  22.     if((Test-Path -Path $iconPath) -ne $true) {
  23.         New-Item -Path $iconPath -ItemType Directory -Force
  24.     }
  25.     # Find .ico files and copy to output path.
  26.     $icons = Get-ChildItem -Path $folder.FullName -Recurse | Where-Object{ $_.Name.Contains(".ico") } | Copy-Item -Destination $iconPath -Force
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement