Support
Please use the Drop Us A Line tab in the top right corner of this site to send us a message.
Purpose
This script allows the user to grab apps from the Winget repository and inject them into Configuration Manager, allowing for thousands of common apps to be updated and patched on a monthly or quarterly basis.
Instructions
Ensure the following:
- Winget is installed on Sysadmin’s computer
- Sysadmin’s computer can run unsigned Powershell scripts, or can sign the script that will be downloaded
- Configuration Manager Powershell cmdlets installed on Sysadmin’s computer (typically already available on a machine with Configuration Manager Console already installed)
- Sysadmin’s PC which is running Configuration Manager Console can access Configuration Manager Primary Site
- Sysadmin’s account has permission to add packages and applications to Configuration Manager Primary Site
Edit yoink4cm.ps1 to update the variables as needed, and specify the files to download using Winget.
The account used to run the script must be able to read/write files on your computer, on your network share, and have permissions to upload / create packages on your Configuration Manager instance.
Once you’ve tweaked the above to your desires, you can use task scheduler to run the task on the first of each month. The account used on task scheduler must have access to read/write files on your machine, read/write access to the Configuration Manager network share, and permission to create packages and applications within Configuration Manager.
Here’s the settings we used:





Variables
The following variables can be modified:
$Sitecode = “ABC:”
Your company’s site code, so the script
$downloadfolder = “Z:\Your Software Share\Configuration Manager\Auto Update\”
$networkshare = “\\Your Software Share\Configuration Manager\Auto Update\”
These 2 variables should be pointing to the same network share folder, one using mapped drive letter (can be any letter, doesn’t need to be Z:), and the other using relative path. The first is for the script to copy files to the share while the second is to specify share location for Configuration Manager packages and applications.
The script will automatically create monthly subfolders within the Auto Update folder so please don’t put other apps or packages in \Auto Update\.
$CollectionID = ‘ABC00001’
Specify this if you wish to enable automatic deployment of packages / applications to a test collection. You must also find and un-comment the 2 lines listed below (in the yoink4cm.ps1 file) to enable automatic deployment:
# New-CMPackageDeployment -CollectionID $CollectionID -StandardProgram -ProgramName $Programname -PackageName $Packagename -DeployPurpose Available -ScheduleEvent AsSoonAsPossible -FastNetworkOption DownloadContentFromDistributionPointAndRunLocally -SlowNetworkOption DownloadContentFromDistributionPointAndRunLocally
# New-CMApplicationDeployment -ApplicationName $Packagename -CollectionID $CollectionID -DeployAction Install -DeadlineDateTime (get-date) -DeployPurpose Available -UserNotification DisplaySoftwareCenterOnly
$DistributionPointGroup = ‘On Prem DPs’
Enter the name of the distribution point packages and applications should be automatically distributed to.
$DurationDivider = 2.5
This allows you to adjust the maximum installation time of a package or application. With the divider rate of 2.5, a 600MB package would have a maximum install duration of 240 minutes.
Winget Syntax
For the purposes of this script, the Winget syntax for downloading an application such as Google Chrome should look like this:
& winget download Mozilla.Firefox -d $Tempfolder
You can add as many applications to the script as you like. To search the Winget repository you must first bring up a command prompt. Next, search Winget for the app you’re looking for. Here’s an example to search all Adobe products:
winget search Adobe
The following table will be displayed. Note the ID of the application you’re looking for and add a new winget download line in the script under the monthly or quarterly section. For example:
& winget download Adobe.CreativeCloud -d $Tempfolder
