Skip to main content

Posts

Showing posts from May, 2014

PowerShell + SCCM 2012 : Create Supersedence Rule

The Application Model in ConfigMgr 2012 let's you do some pretty neat things. One of those things is specifying supersedence. The ConfigMgr 2012 SDK has an example in C# showing how to create the Supersedence, so I studied it and was able to re-produce it in PowerShell. Scenario I have two Notepad++ Applications as below, We will create the Supersedence rule for 6.5.1 making it supersede 6.2.3. Look below for the terminology. Rest of the Story: code and walkthrough The code is pretty long and will step through it  in pieces. Won't be using the ConfigurationManager PowerShell module. This is entirely WMI/CIM and some .NET Fu at work ;) First let's get the pre-requisites out of the way by doing below: 001 002 003 004 005 006 #Load the Default Parameter Values for Get-WMIObject cmdlet $PSDefaultParameterValues   = @{ "Get-wmiobject:namespace" = "Root\SMS\site_DEX" ; "Get-WMIObject:computername...

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 Tip: Get MachineName for a User

While doing Application deployments , we have cases where the User forgets to specify the Machine Name to which a software needs to be deployed to. We use Query-Based Deployment rules in ConfigMgr where we add the machine names to a Collection named after the Application..have already automated this process ;) But if the machine name is not specified then we either: Get the Machine name from SCCM Reports if available. Drop an email to the Requester for the same For getting the machine name for a User in ConfigMgr 07 we use the Reports obviously :D The report is located under "Users" node in ConfigMgr Reports page. But actually this can be retrieved using WMI/CIM too. The Class which has this info is SMS_R_System under namespace Root/SMS/site_<SiteCode> and let's take a look at it. Note: Before going further I have already set the ComputerName parameter and namespace parameter in the $PSDefaultParameters. Below is how you do it in...