Giter Site home page Giter Site logo

markhallen / cmutilities Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 31 KB

In Microsoft System Center Configuration Manager we can automate recurring tasks or batch jobs using PowerShell.

Home Page: https://markallenit.com

License: MIT License

PowerShell 100.00%
powershell sccm-collections configmgr microsoft sccm pester

cmutilities's Introduction

Build status

CMUtilities

In Microsoft System Center Configuration Manager we can automate recurring tasks or batch jobs using PowerShell.

Limiting collections - given a collection folder the limiting collection of each collection therein will be set to the value specified.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • PowerShell
  • The SCCM console is required
  • An account with permission to modify collections

Installing

From source

Copy locally and then import the module.

Import-Module .\CMLimitingCollection\CMLimitingCollection.psm1

From PowerShell Gallery

Import-Module -Name CMLimitingCollection

You can view the module on the PowerShellGallery here.

Basic usage

  1. Copy the folder path from the console folder

Image of copying the console folder path

  1. Invoke the Set-LimitingCollection funtion and paste the console folder path and the target limiting collection name

Set-LimitingCollectionForFolder -Path "\Assets and Compliance\Overview\Device Collections\Applications" -LimitingCollectionName "Windows desktops"

Syntax

Set-LimitingCollectionForFolder -Path <String> -LimitingCollectionName <Object> [-SiteCode <String>] [-SiteServer <String>] [<CommonParameters>]

Set-LimitingCollectionForFolder -Path <String> -LimitingCollectionId <Object> [-SiteCode <String>] [-SiteServer <String>] [<CommonParameters>]

.PARAMETER Path
The path to the console folder containing the collections to be updated.

.PARAMETER LimitingCollectionName
The name of the new limiting collection.

.PARAMETER LimitingCollectionId
The CollectionId of the new limiting collection.

.PARAMETER SiteCode
[Optional] Connect to the specified site. If no value is provided the default site
used by the locally installed SCCM client will be used.

.PARAMETER SiteServer
[Optional] Connect to the specified site server. If no value is provided the default site
server used by the locally installed SCCM console will be used.

Running the tests

Unit tests can be run using Invoke-Pester

Built With

  • PowerShell
  • Microsoft System Center Configuration Manager
  • Pester

Tested With

  • PowerShell 5.1
  • Microsoft System Center Configuration Manager 1706
  • Pester 3.4.0

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

cmutilities's People

Contributors

markhallen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

cmutilities's Issues

Error: Object reference not set to an instance of an object

Hello,

When I want to import the module with the command
Import-Module -Name CMLimitingCollection -Verbose
I have this following error:

VERBOSE: Loading module from path 'C:\Program
Files\WindowsPowerShell\Modules\CMLimitingCollection\1.0\CMLimitingCollection.psd1'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\CMLimitingCollection\1.0\CMLimitingCollection.Format.ps1xml'.

Import-Module : Object reference not set to an instance of an object.
At line:1 char:1

  • Import-Module -Name CMLimitingCollection -Verbose
  •   + CategoryInfo          : InvalidOperation: (:) [Import-Module], NullReferenceException
      + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
    
    

The command Get-Module -ListAvailable gives me that:

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Script 1.0 CMLimitingCollection {Set-LimitingCollectionForFolder, ConvertTo-CMFolderPath}
Script 1.4.4 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa..
Script 2.2.1 PowerShellGet {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap..

...

That means the module is correctly installed.
In some forums they say I should disable the import of the ps1xml file. But in this case I even don't see anymore the CMLimitingCollection module.

Is it normal that the file "CMLimitingCollection.Format.ps1xml" is empty ?

Thank you in advance for your answer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.