Skip to main content

Posts

Showing posts from April, 2014

PowerShell + SCCM 2012 R2: Get the Device/ User Info WMI Way

This is in continuation of my last post on Using PowerShell to get client information   In this post will be exploring on the ways to do the same thing using WMI/CIM, Why ? With WQL syntax we can ask for only the properties we need rather than getting everything back. The post will cover 3 topics: Query individual Device in CM using WMI/CIM Query Members of a Device Collection using WMI/CIM Query Users in a User Collection using WMI/CIM To get the number of properties got back from a call to Get-CMDevice use Get-Member and Measure-Object like below: Most of the properties returned back may be empty depending on how you are using ConfigMgr e.g if you use endpoint protection than those attributes in the class will be populated else will be empty. Now if you see the output of Get-CMDevice is actually is a result of the SMS_CombinedDeviceResources Let me tell you a little secret :-$ ...if you are looking forward to explore WMI part of ConfigMgr and have a doubt on whic

PowerShell + SCCM 2012 R2: Get the Client Info Easy Way

One of my friend Krishna called and asked me on how to get the report for the  Management Point to which SCCM clients (part of a Collection) report to. This is normal day to day task in a ConfigMgr Admin's life and most of us would go and use Reports in Configuration Manager . But he wanted to do this using PowerShell...... hmmm :-?  Now you are talking :-b If you are using Configuration Manager 2012 and haven't started using PowerShell then you as missing one of the Coolest things that can make your job easy. In ConfigMgr 2007 we had an option to export the list of members from a Collection , see below: This was convenient but sadly it's not there now. But we can do a lot more if we choose to use PowerShell here. This is not a very complex thing to do if you are comfortable with PowerShell, so I am going to do it 2 ways: Easy Way : using cmdlet Get-CMDevice WMI Way   :P (next Post)  E asy Way : using cmdlet Get-CMDevice On your ConfigMgr Console to

PowerShell + SCCM 2012 R2 : Deploy PowerShell Scripts

[ UPDATE ] Looking for more #PowerShell + #ConfigMgr awesomeness , Check out my compiled list of posts -->  www.dexterposh.com/p/collection-of-all-my-configmgr.html Earlier I blogged about using PowerShell to create an Application from MS I  but wait am just warming up to what Configuration Manager has to offer with PowerShell :D In this post we will be creating an Application having a deployment type which will run PowerShell Scripts (Install / Uninstall). Detect if the Script needs to be run on the Client (using PowerShell code) this is something called Script Detection Method in ConfigMgr. Let me put this in simple layman terms we will be deploying Scripts to clients and executing them using Configuration Manager Infrastructure. Scenario: If you haven't configured Virtual Memory (Page File Size) manually then the System manages it for you. So is the case with all the Systems in my Lab. So I want to deploy a PS1 Script which will set this (install) and anothe

Remotely Set State and StartMode of a Service using PowerShell

Well as the name suggests this is a very simple and straightforward post. Most of the PowerShell Geeks out there already know that we can do it in various ways: Using Set-Service Using PSRemoting Using WMI (Win32_Service) In our environment at office we don't have PSRemoting yet enabled, but it's okey we can come around that. In addition would like it to be PowerShell v2 compatible you never know who asks you for this Script running on v2. We can use Set-Service which has - ComputerName parameter, in case you haven't checked. But it fails to start/ stop a remote service if there are dependent services. C:\> gsv -Name bits -ComputerName DexterClient1 Status Name DisplayName ------ ---- ----------- Running bits Background Intelligent Transfer Ser... C:\> Set-Service -Name BITS -Status Stopped -ComputerName DexterClient1 -Verbose VERBOSE: Performing the operation "Set-Service" on target "Bac

PowerShell + SCCM 2012 R2 : Create Folders to organize

In the last post we took a look on how to create an Application from a MSI and deploy it using PowerShell :) But if I take a look at the Application Root node at the moment everything gets listed here . Say if I have 200 applications then it seems a bit messy...Let's organize them in a better way using "Folders" in ConfigMgr 2012. Applications Node: Folders are used to better organize Objects and it can have Objects of one type only. We will come to appreciate this when we see the end result. How do we create Folders ? Well there are a couple of ways I know of: Manual through ConfigMgr Console Using PowerShell CMSite PSProvider (exposed through the ConfigMgr Module) Using WMI Manual Way: I would like to organize the Apps based on the Vendor, so that Apps from same vendor are easy to locate. For Ex: Quest AD Snapin will fall under "Quest" 7-zip will fall under "OpenSource" etc. So go to the Applications nod