Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'd like to use PowerShell to get a list of available applications in the Software Center, and then pick the ones I wish to install on a local computer with a PowerShell script.

What I have tried:

So far I only managed to find a piece of script on the internet, that shows how to list software that is or has been installed on the computer:
PowerShell
Get-WmiObject -Namespace "root\ccm\ClientSDK" -Class CCM_Application | where {$_.Name -like "Applications name here"}

From there I can choose to reinstall that software, if it's on the list.
However, it needs to have been installed before if above code is to work. If I want to list and install software from the Software Center that has not been installed on the computer yet, like if it's a fresh Windows installation, then the above script will not show any applications listed in PowerShell even though they are available in the Software Center and even though I can see them (fx. Firefox, Zoom Video and VLC Player) in the Software Center GUI if I start it up.
Posted
Updated 30-Mar-21 6:30am
v3
Comments
Jo_vb.net 30-Mar-21 13:42pm    
This article seems to be something where you could start from:
https://docs.microsoft.com/en-us/powershell/scripting/samples/working-with-software-installations?view=powershell-7.1
Dave Kreskowiak 30-Mar-21 13:56pm    
That and look at the documentation for the CCM_Application class, here[^], and notice there is an Install method that you can call through WMI.
httitb 30-Mar-21 14:17pm    
Thanks to both of you. I'll make sure to check out those articles and continue from there.

1 solution

$SCApplicationName = 'Office 365 Setup'

$SCApplication = Get-WmiObject -Namespace "root\ccm\ClientSDK" -Class CCM_Application | where {$_.Name -like $SCApplicationName}

[hashtable]$Arguments = @{Id = $SCApplication.Id;IsMachineTarget = $SCApplication.IsMachineTarget;Revision = $SCApplication.Revision}

[cimclass]$CCMCimClass = Get-CimClass -Namespace 'Root\ccm\clientsdk' -ClassName 'CCM_Application'
Invoke-CimMethod -CimClass $CCMCimClass -MethodName 'Install' -Arguments $Arguments
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900