Skip to main content

Posts

PowerShell + AD + Pester : create new user using template Part 2

It seems like it has taken me forever to post this one. I had this one almost ready but then I asked few questions around, read a lot of posts and had to rewrite the pieces of the post, to sum it all it has been an eye opening when trying to test PowerShell code which interacts with Infrastructure. Below pic depicts my state at this point ( revelation to a whole new world). [ credits : movie "V for Vendetta"] In the last post , we laid the foundation for our Function. Go back and check the code their as we start from where we left off. In this post we dive straight into the third context for our Pester tests : Context  "User Creation"    It  should return Object when -Passthru specified (New addition)   It  should take OU Path from template User.    It  should only copy allowed set of attributes from the User (by default).    It  should allow copying a subset of allowed set of attributes .     Note - ...

PSConfAsia : My experience

Since it has been few weeks after PowerShell conference Asia, I have finally kicked of the laziness and made up my mind to blog about my experience around it. PowerShell Conference Asia

PowerShell + AD + Pester : Create new user using template - Day 1

I did a blog post, way back to create new users in AD using already existing user as a template,  but many people commented about using the template didn't copy the Home Directory, logon script path, group membership etc. So finally I tried my hands on writing a Function which does a better job at this. The idea is to write a New-ADUserFromTemplate function, to which you specify all the properties you want copied while creating a User from an existing User (template User). Let's make it fun and write the code using the Behavior Driven development approach using Pester. This will probably a 2 part series : Day 1 - Getting the Ground Work ready, Pester tests for Parameter, Help & Module dependency . Day 2 - Write Pester tests and code for the actual function. Refactoring the Code. So we plan to do BDD or TDD here which means we write tests first and then follow the below cycle :

PowerShell + Server 2016 TP3: Deploy using Azure Automation

With an awesome and exciting features being shipped in Server 2016 TP3, I am sure you are going to take a crack at it. What better way  to deploy it n cloud in few minutes using Azure Automation Runbook. I did something similar a while back and have updated the Script to expose new parameters and by default use the Server 2016 TP3 image for now (you can override this value). Also if you are an ITPro like me and have a test LAB running on Azure then you can pass in the arguments to -DomainName and -DomainCredName parameters and the Runbook actually retrieves the Automation Credential Asset and joins the Server 2016 TP3 VM to the AD domain you have running on Azure (make sure the VM is in a Subnet which is reachable to your DC and the DNS is configured properly for the name resolution.

PowerShell + SCCM 2012 : Create Packages & Programs

It has been a while, since I chartered the waters of WMI and Configuration Manager, so pardon any silly mistakes made. One of my friend from PSBUG asked me few questions revolving around creating packages & programs in ConfigMgr using PowerShell. Every ConfigMgr admin knows that new Application model has been introduced in ConfigMgr 12 but the Packages are here to stay for a while. Packages and Programs are ideal for deploying Scripts (one time or reoccurring ones) and better suited for deploying apps during OSD (heard this one). ConfigMgr ideally has 3 ways of working with it and below is the pic which says it all : The post is broken up in 3 parts (based on how you use ConfigMgr): GUI Way - Doing this to show background on how we do it manually. Cmdlet Way - using the CM cmdlets to create the package and program WMI Way - exploring WMI to do the same.

PowerShell + Azure + Python : Use Project Custom Settings

Background First to set up the background [bit reaching on the Dev side] on the post, quick introduction to what is an Azure Cloud service along with some terms Dev like to throw around: Cloud Service : PaaS offering , running VMs on Microsoft Azure. You have control over these VMs as you can remote into them and customize them to run your apps. A typical cloud service contains: Web Role - Windows Server running IIS on top of it. Worker Role - Windows Server. Now using Visual Studio one can configure the Cloud Service as per ones need (Check Resources at the bottom). There are typically 2 files in your project definition which need tweaking (source : MSDN - link in Resources section) : ServiceDefinition.csdef   :  The service definition file defines the runtime settings for your cloud service including what roles are required, endpoints, and virtual machine size. None of the data stored in this file can be changed when your role is running . ServiceConfigur...

PowerShell MVP 2015

I received the official notification yesterday that my PowerShell MVP award has been renewed !!