Basically what I want to create is a PowerShell script to compare the applications included in an OEM install of Windows 10 against those included in a clean install of Windows 10 and copy any application links which aren’t on a clean install to a specific folder so that I can easily see which apps have been added by the OEM.
I’ve figured out how to get a list of which applications have links on the Start Menu:
$Path = "$Env:ProgramData\Microsoft\Windows\Start Menu\Programs" Get-ChildItem $Path -Recurse -Include *.lnk
And I’ve figured out how to assign that to an array:
$a = Get-ChildItem $Path -Recurse -Include *.lnk
Or how to copy that list of shortcuts to a folder:
Get-ChildItem $Path -Recurse -Include *.lnk | Copy-Item -Destination C:\temp\
Or save the list to a CSV:
Get-ChildItem $Path -Recurse -Include *.lnk | Export-Csv list.csv
And how to assign a CSV to an array:
$b = Import-Csv list.csv
And how to compare two arrays:
Compare-Object $a $b
But this is where I get stuck. I want to be able to do this:
Run this on a computer with no 3rd party apps, only a clean Windows 10 install:
$Path = "$Env:ProgramData\Microsoft\Windows\Start Menu\Programs" Get-ChildItem $Path -Recurse -Include *.lnk | Export-Csv cleaninstallapps.csv
Then take the cleaninstallapps.csv and copy it to a computer with 3rd party apps on it and get a list of only the apps which are not part of a clean Windows 10 install. And then copy links to those apps to a folder by doing this:
$Path = "$Env:ProgramData\Microsoft\Windows\Start Menu\Programs” Get-ChildItem $Path -Recurse -Include *.lnk | | Export-Csv oeminstallapps.csv $a = Import-Csv oeminstallapps.csv $b = Import-Csv cleaninstallapps.csv Compare-Object $a $b | Copy-Item –Destination C:\OEM_Programs
Everything works up until it gets piped to Copy-Item. Something is lost that doesn’t stop Compare-Object from working but does stop me from successfully piping that to Copy-Item. Any ideas for how to accomplish this task?