Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Create and Manage Packages with New-CMPackage in Windows

Creating and managing software packages in a Windows environment can be efficiently handled using the New-CMPackage cmdlet in PowerShell. This cmdlet is part of the Configuration Manager module, which is used to automate and manage software deployment within a network. This article will guide you through the process of creating a new package using New-CMPackage, along with practical examples to illustrate the steps.

What is New-CMPackage?

New-CMPackage is a cmdlet in the Configuration Manager (ConfigMgr) module for PowerShell. It allows administrators to create new software packages that can be deployed to client machines within a network. This cmdlet is particularly useful for automating the deployment process and ensuring that software installations are consistent across all machines.

Prerequisites

Before you can use New-CMPackage, ensure that:

  1. You have the Configuration Manager Console installed.
  2. You have administrative privileges on the ConfigMgr server.
  3. You have the necessary PowerShell module imported.

How to Create a New Package

Step 1: Open PowerShell with Administrative Privileges

First, open PowerShell with administrative privileges. You can do this by searching for "PowerShell" in the Start menu, right-clicking, and selecting "Run as administrator."

Step 2: Import the Configuration Manager Module

Import the Configuration Manager module to ensure you have access to the New-CMPackage cmdlet.

Import-Module 'C:\Program Files (x86)\Microsoft Endpoint Manager\AdminConsole\bin\ConfigurationManager.psd1'

Step 3: Connect to the Configuration Manager Site

You need to connect to your Configuration Manager site. Replace 'YourSiteCode' with your actual site code.

cd 'C:\Program Files (x86)\Microsoft Endpoint Manager\AdminConsole\bin'
.\ConfigurationManager.psd1
Set-Location 'YourSiteCode:'

Step 4: Create a New Package

Now, you can create a new package using the New-CMPackage cmdlet. Below is an example of how to create a package for a software application.

New-CMPackage -Name "MySoftwarePackage" -Description "This is a sample software package" -Path "\\YourServer\Share\PathToSoftware" -Manufacturer "SoftwareManufacturer" -Language "English" -Version "1.0.0"

Example: Creating a Package for Notepad++

Let's create a package for Notepad++ as an example.

  1. Ensure the Notepad++ installer is located at \\YourServer\Share\Notepad++.

  2. Run the following PowerShell script:

New-CMPackage -Name "Notepad++" -Description "Notepad++ Text Editor" -Path "\\YourServer\Share\Notepad++" -Manufacturer "Notepad++ Team" -Language "English" -Version "7.9.5"

Verifying the Package

After creating the package, you can verify it by listing all packages in the Configuration Manager.

Get-CMPackage

This command will display a list of all packages, including the one you just created.

Conclusion

Using the New-CMPackage cmdlet in PowerShell simplifies the process of creating and managing software packages in a Windows environment. This ensures that software deployments are consistent and automated, reducing the risk of manual errors.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.