Skip to main content

Posts

Showing posts with the label ConfigMgr07

PowerShell + SCCM 2012 Tip : Get OS Inventory

Another post inspired by the daily job as a ConfigMgr Admin. Usually while deploying applications as a best practice we check few details about the machine like the Operating System it's running on to ensure that we deploy the correct package targeted to the correct OS. In past there have been cases where a package targeting XP was send to a Windows 7 machine or vice-versa. So how do I check OS information : If Machine is online ;Use PowerShell or any other tool to query WMI to get the info. If Machine is offline ;Head over to SCCM Reports to see the info We can use PowerShell to do perform the second part as well because ConfigMgr SMS namespace  provider stores this information in the class named SMS_G_System_Operating_System . Note - The data in the class SMS_G_System_OPERATING_SYSTEM is stored as a result of the Hardware Inventory of the Win32_OperatingSystem class on a remote machine. So if the H/W Inventory has not run then this data is not ava...

PowerShell + SCCM 2012 R2 : Extending Discovery; Create Custom DDRs

While working on the previous post on exploring Discovery methods with PowerShell I came across this awesome post on creating custom DDRs with PowerShell in ConfigMgr07. http://marcusoh.blogspot.in/2010/10/sccm-custom-data-discovery-records-ddrs.html The above post explains how to create custom DDRs using ConfigMgr SDK for ConfigMgr 07. So I got tempted to immediately try it out in my ConfigMgr12 environment and found out that there exists another cool way shown by Adam Meltzer  (using C#) in his blog to create DDRs in ConfigMgr12. So in this post will try to cover : Create DDRs using COM Interface (DLL used : smsrgenctl . dll ) Create DDRs using the new DiscoveryDataRecordFile Object Interface (DLL used:  Microsoft.ConfigurationManagement.Messaging.dll ) Note : Both the above DLLs are part of ConfigMgr 2012 SDK. Create DDRs using COM Interface (DLL used : smsrgenctl.dll) Tried loading the smsrgenctl.dll from PowerShell using Add-Type , System...

Use PowerShell to remove packages from the Distribution Points

This post is inspired by one of the activities which we had to recently do. We have a lot of branch DP's where we want to cleanup all the obsolete packages (which are not used anymore). This can be done manually by going in the ConfigMgr Console Packages node and updating the DP's manually for each package. But where is fun in doing that ...Lol I couldn't find much on the internet ..So I tested it in my Lab first and then in QA in our environment and then did it in PROD. For this post demonstration I am showing this on my LAB (ConfigMgr12) but it does work with ConfigMgr07. Note - ConfigMgr 2012 R2 has this cmdlet  Remove-CMContentDistribution which can do this but am showing the method which will work with all ConfigMgr versions (hopefully). Right now I have distributed 3 packages to the only DP (DexSCCM) in my environment. Now we can get the same Information about which DP the particular package is Distributed by querying the SMS_DistributionPoint Class. ...

SCCM 2007 + PowerShell -- Final Post

This is the last post on the SCCM 2007 + Automation Series in this blog. I will share the Script with which I was able to achieve automation of the Query Based Deployments. Finally using this Script I can Add machine names to the Query Membership Rule in a Collection...thus freeing myself of the GUI clicks needed in ConfigMgr Console. So I have a test collection by the name "Deepak test 1" and what I have done is removed all the Query Rules from it to show how the Script works. So Initially the collection has no Query membership rules, as evident from below screenshot of the Collection Properties in the ConfigMgr07 console: And below is a count of no of members inside the collection...No members I will be using the SCCM-Commands PowerShell module for my Script , I did cover some parts of it in previous post So I will describe the logic quickly.....I have a Function named Add-MachineToSCCMQueryRule which is the Function which will add specified machine na...

SCCM 2007 + PowerShell - WMI is the key to automation Part 2

In Previous post I talked about how to explore the WMI namespace for ConfigMgr 07. In this post would like to point out on how to use the  SCCM-Commands PowerShell Module  , this Module leverages WMI with PowerShell. Many thanks to  Michael Niehaus,  Rikard Ronnkvist,  Stefan Ringler and  Ricardo Cheing  authors of this Module for sharing this. Download this module and extract it, it contains a single PowerShell Module file .this is a Script Module ( SCCM-Commands .psm1). Place this File under your Modules Directory in a folder named same as the module i.e. SCCM-Commands Now you should be able to see the Script module in you session like below: Now you have to import the module and then you can list all the Advanced functions shipped with this module using either of the below 2 ways:  1. Use Get-Command -Module SCCM-Commands  2. Or Use Get-SCCMCommands function within the module itself. Now the Functi...

SCCM 2007 + PowerShell - WMI is the key to automation Part 1

Well in the quest of automating ConfigMgr 07.....WMI is the key. Now this post isn't a primer on how to use WMI with PowerShell. There are very good resources which you can hit like: Free Ebook by Ravi Sir (PowerShell MVP) - " WMI Query Language via PowerShell " (referred to me by  @LaerteSQLDBA  :) ) Book by Richard Siddaway (PowerShell MVP) - " PowerShell and WMI " There are other good resources like  HeyScriptingGuy's  blog where one can serach for WMI tag, there is whole bunch of information out there on leveraging WMI with PowerShell. If you haven't checked out this yet then you are missing something very cool to manage your Infrastructure. That being mentioned the journey to exploring WMI starts by connecting to the SCCM Site System which has the SMS provider installed. Open the ConfigMgr console > Connect to your Central Site/Primary Site > Site Management > Right -click site ...select Properties. The information where SMS...

SCCM 2007 + PowerShell Automation - The Problem with Query Based Deployments

Few months back, I made a resolution of automating the deployment process used in our Project, Scenario So if a User needs applications in their machine , they raise a request for the same. After the approval process it comes to our team and we handle the deployment of these apps to the User machines using SCCM 2007 (or ConfigMgr). So this is how we do it ....we have the QueryRules for the Application collection in place we just go there and add the machine name there manually in the Query Rule for the Application Collection.  To go with the post I have a test collection in place by the name " Deepak Test 1 "...So first I will be showing how we do this manually and then later on how I did it using PowerShell. There something called "Click Count" which is a rough count of how many mouse clicks am using to do these actions in ConfigMgr MMC Console (rough estimate) Click Count = 1 Manual Way Step 1. Right  Click and open the properties for...