Skip to main content

Posts

Showing posts from June, 2014

PowerShell + SCCM 2012 : Get Started with CM Cmdlets

This post will quickly cover on how to start using PowerShell with ConfigMgr. It's good to see that ConfigMgr Admins are finally embracing the Shell :)  Planning to have one of these getting started hangouts for PowerShell Bangalore User Group (@PSBUG) in near future. There are essentially two routes: Using ConfigurationManager Cmdlets Using WMI / CIM (next post probably) Using ConfigurationManager Cmdlets ConfigMgr starting from 2012 SP1 has got the official PowerShell support, which means when you install the ConfigMgr console on a machine then you will get a PowerShell Module along with it in the below location : <drive>\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin Don't worry you don't have to remember this. There is an environment variable SMS_ADMIN_UI_PATH which holds this piece of information for you (Note the path we need is till bin folder only )  The best way to get the CM cmdlet

PowerShell + SCCM 2012 : Automate Patching

This is an evolving post and is related to a project aiming to automate Software Updates in our environment.  The environment is a little complex as we have to work with other teams to get the list of Bulletin-IDs of S/W Updates (or patches) which will be deployed to our environment. So we can't probably go for ADR in CM 2012. So we will look at automating this Patching scenario from the very beginning where we get a list of Bulletin-ID's from outside source. Note - This post is inspired by Steve Rachui 's post on Automating Software Updates, where he has shown some very cool stuff (link at the end check that one out). Thanks to Stephane  >:D<  for sharing his WMI Functions which helped me a lot, along with cool B-) people like Kaido , Peter & David who have shared there awesome work :). All the resources link are at the end of the page. Below are the steps we will follow, which should get someone started who is looking to achieve the same: Get li

Tip - Add Syntax highlighting for PowerShell Code

There are lot of ways to add syntax highlighting to the PowerShell code in your blog, see the post by MVP Francios Xavier-Cat. I just happened to come across one more which is pretty easy to use and best part is it uses a PowerShell module to do so. Follow the below steps : Download the Copy to Colorized HTML module  and put the extracted copy in your Modules directory. Add the below code to your ISE Profile, which will add a submenu and the "Ctrl+Shift+C" shortcut to copy the HTML content in your clipboard.  $psISE . CurrentPowerShellTab . AddOnsMenu . Submenus . Add( “Copy As Colorized HTML” , { Copy-ColorizedHTML } , “Ctrl+Shift+C” )  |   Out-Null The module has a single cmdlet called "Copy-ColorizedHTML" which copies the HTML content in your clipboard for use. Once the content is copied to your clipboard just paste it to your blog. NOTE - This method can also be used to while authoring an article for Technet Wiki. see th

PowerShell + SCCM 2012 : Create Dependency Rules

Following on my last post on creating supersedence rules in ConfigMgr Applications with PowerShell, this post is all about creating dependency rules. The approach is very similar to the last one and Adam Meltzer had already posted the sample C# version of the code here  . Have to admit I tried to re-use the code from the last time and in the Process screwed one of the Applications (by putting up wrong serialized XML on the WMI Instance of the App). There can be multiple dependencies in ConfigMgr (attached with a OR or AND operator), but for the sake of simplicity we will look at a very simple scenario  : Scenario: For Application 1 ( Notepad++ in this case) we will add an Application 2 (e.g .NET 4 ) as the dependency. I know that hardly is a dependency but I am a bit lazy to create other applications at the moment...though I can do that with #PowerShell too..but am too lazy for that too :P  At the end of the Code we will get this relationship: Code and Walkthrou