2017/04/03

Moving my blog

I decided to give a try to Jekyll and moved my blog to Github Pages.

Here is the new link: https://lazywinadmin.github.io/

You can subscribe to my RSS feed here: http://feeds.feedburner.com/lazywinadmin

See you there ! 😉

2016/09/20

My presentation at the first meetup of the French PowerShell User Group



Today I presented a session on Parsing Data using PowerShell at the first meeting of the French PowerShell User Group.

This User Group is organized by a couple of Francophone PowerShell MVPs, including me, from different parts of the world.

Below are the presentation, the scripts and the recording of the meeting. Even if you don't speak the language of Molière you should be able to follow along with the PowerShell language.

Presentation (PPTX) and Scripts : Github Repository of FRPSUG



Registration to our next events: Meetup.com

Slack: Feel free to drop by on our channel #french on powershell.slack.com (register first)




Thanks for reading! If you have any questions, leave a comment or send me an email at fxcat@lazywinadmin.com. I invite you to follow me on Twitter @lazywinadm / Google+ / LinkedIn. You can also follow the LazyWinAdmin Blog on Facebook Page and Google+ Page.

2016/08/29

PowerShell Tip - Generate a list of Mac Addresses

While playing in my lab I needed to create a bunch of fake Devices in System Center Configuration Manager (SCCM). When creation devices you need two pieces of information, the computer name and the Mac Address of the device.

I used the following method to generate my list of mac addresses.

# First, get a list of mac address.
1..150 | ForEach-Object { '{0:X12}' -f $_ }
# Second step: Before we import we need to add a colon ":" every two characters
1..150|%{((('{0:X12}' -f $_) -split '(..)')|?{$_}) -join ":"}


What is happening here

  1. We list from the number 1 to 150
    1. 1..150

2016/08/28

PowerShell - Composite Formatting references (-f Operator)

If you play often with PowerShell you might have encountered something called "Composite Formatting". What is that ? Here is a quick example

"Welcome to {0}" -f "LazyWinAdmin.com"


Each format item takes the following form and consists of the following components:
{index[,alignment][:formatString]}
The matching braces "{" and "}" are required.


Composite Formation

The .NET Framework composite formatting feature takes a list of objects and a composite format string as input. A composite format string consists of fixed text intermixed with indexed placeholders, called format items, that correspond to the objects in the list. The formatting operation yields a result string that consists of the original fixed text intermixed with the string representation of the objects in the list.
https://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110).aspx

##########################
# Numeric Format Strings #
##########################

# The Decimal ("D") Format Specifier
"{0:D}" -f 50999994 #50999994
"{0:D10}" -f 50999994 #0050999994
"{0:D6}" -f -1234 #-001234

2016/08/24

PowerShell/Pester - Make sure your parameters are separated by an empty line


Today, I continue with another post on Pester. I want to check that each of my parameters declared in my PARAM() block is separated by a empty line.

This will help bring clarity to my code and make it easier to read for other people.



Here is an example, I don't want this:

Instead, I want all the comment based help in that format



2016/08/22

PowerShell/Pester - Make sure your Comment Based Help is not indented


While writing some PowerShell Pester tests for my module AdsiPS, I wanted to make sure for each functions that all the help keywords of the comment based help were not indented.

Depending of the script editor you are using, the number of spaces or tabs might differ and once published on GitHub the code might looks not so pretty.


My goal is just to keep my code clean and enforce the same practice across all the functions.

Here for example, I don't want this:
Instead, I want all the comment based help in that format


2016/08/20

Launch of / Lancement du French PowerShell User Group

[English below]

Depuis un moment, dans la Communauté PowerShell francophone,  je vois un certain nombre de développeurs, administrateurs et MVP  d’un peu partout dans le monde exprimer le désir d’avoir un groupe d’utilisateurs PowerShell.

Nous avons tous une famille, un travail, des loisirs et organisé un évènement prend beaucoup de temps, surtout pour trouver des salles, des sponsors, des présenteurs, etc…

Donc, … il y a quelques semaines j’ai commencé une conversation avec quelques gars du domaine et lancer l’idée d’un groupe d’utilisateurs uniquement en ligne (pour le moment) en utilisant Meetup.com / Google Hangout On Air / Youtube Live. Cela facilite énormément l’organisation, permet l’enregistrement du meeting automatiquement et à tous d’assister au meeting peu importe l’endroit.

2016/08/18

PowerShell 10th Anniversary - Open Source / Running on Linux and Mac OS X

The PowerShell Team just dropped a bombshell !

Windows PowerShell is now a cross platform technology with the availability of PowerShell on Linux and Mac !! .... AND.... The PowerShell team is Open Sourcing Windows PowerShell (.Net) and PowerShell Core (.Net Core) !! This is so Cool !!!

Today (2016/08/18) also marks the 10th Anniversary of PowerShell ! Quite a surprise that the PowerShell team prepared for us :-) Given the recent changes in leadership and culture, It is really nice to see Microsoft taking that direction.




PowerShell is now Open Source

Under the MIT License, PowerShell is now an Open Source Software (OSS).

This was made possible with the release of the .NET Core Framework, foundational libraries called CoreFX. A framework available on Windows, OS X and Linux! .NET Core is cross-platform and open source.

PowerShell Core is fairly recent and does not offer all the cmdlets available on PowerShell yet since they don't rely on the same Net Framework as Windows PowerShell (.NET). As a side note, Windows Server 2016 Nano Edition (aka Nano Server) is running on PowerShell Core.

PowerShell is now a Cross Platform technology

In addition to Windows Client and Server, PowerShell is now available on the following operating systems:
  • Linux
    • Ubuntu 14.04 \ 16.04
    • CentOs 7.1
    • RHEL 7
  • MAC OS X
    • OS X 10.11

Download / Test / Contribute

The source are located on Github on the following repository https://github.com/PowerShell/PowerShell

It also worth to note that the PowerShell Team is also providing some nice examples/demos on their GitHub repository: https://github.com/PowerShell/PowerShell/tree/master/demos

Some of the examples available:

Some of those are also demoed in a video here:



Installing PowerShell Core on Linux and Mac

Here is the documentation on how to proceed with the installation of PowerShell Core on Linux and Mac. https://github.com/PowerShell/PowerShell/blob/master/docs/installation

At the time I'm writing this, I only see documentation on how to install PowerShell Core on Linux


PowerShell Core on Linux

PowerShell Core on MAC OS X