Loading...

Follow LazyWinAdmin on Feedspot

Continue with Google
Continue with Facebook
or

Valid
LazyWinAdmin by François-xavier Cat - 3w ago

I’m very pleased and honored to receive the Microsoft MVP award for another year for the category Cloud and DataCenter Management MVP !

Dear Francois-Xavier,
We’re once again pleased to present you with the 2019-2020 Microsoft Most Valuable Professional (MVP) award in recognition of your exceptional technical community leadership. We appreciate your outstanding contributions in the following technical communities during the past year:
Cloud and Datacenter Management

**I want to thank everyone for their support, the incredible Community and the teams at Microsoft :bow:

In the last year most my contributions were around:

See my Microsoft MVP profile here.

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 
LazyWinAdmin by François-xavier Cat - 4M ago

Here is a recording to demo how you can install, configure and use the MVP PowerShell module to add your contributions into the MVP Website.

Using the PowerShell MVP Module - YouTube


# Install the module
Install-Module -Name MVP -Scope CurrentUser -Verbose

# Configure your connection
Set-MVPConfiguration -SubscriptionKey 2ed3d4ddf0e948a28caeebba64620d20

# List the commands available
Get-Command -Module MVP

# Retrieve my profile
Get-MVPProfile

# Add a new MVP Entry
New-MVPContribution `
    -StartDate '2019/03/26' `
    -Title 'Test From MVP Module' `
    -Description '' `
    -ReferenceUrl 'https://lazywinadmin.com' `
    -AnnualQuantity 1 `
    -AnnualReach 1 `
    -ContributionType Article `
    -ContributionTechnology PowerShell `
    -Visibility Microsoft `
    -verbose

# Add multiple entries
Import-CSV C:\demo\testcontributions.csv | New-MVPContribution -Verbose

You’ll find more information about this module here:

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Tested on PowerShell Core 6.1.0 (Microsoft Windows 10.0.17763)

Recently I had to parse a bunch of log files for one of my projects, but the date format what not really ideal for sorting per date.

As an example, here is one of the log format.

Parsing the file using Import-CSV

Since we have a delimiter available between each values ;, we can leverage Import-CSV to parse the file and assigned the different values to properties with the -Header parameter.

import-csv -Path .\ScriptExample-20181002134401.log -Delimiter ';' -header 'Date','Type','Message'

Output:

Date           Type Message
----           ---- -------
20181002134401 INF  +----------------------------------------------------------------------------------------+
20181002134401 INF  Script fullname          : C:\FX\script_example.ps1
20181002134401 INF  Current user             : DEMOCOMP\FX
20181002134401 INF  Current computer         : DEMOCOMP
20181002134401 INF  Operating System         : Microsoft Windows 10 Entreprise 2016 LTSB
20181002134401 INF  OS Architecture          : 64 bits
20181002134401 INF  +----------------------------------------------------------------------------------------+
20181002134401 INF  Connect to database 'SQLSERVER01'
20181002134401 INF  Create splatting
20181002134401 INF  Append parameters
Problem and Solution

However the first column Date is not interprated as a DateTime type. For this you can leverage the Method ParseExact from the [datetime] class.

You’ll need to pass the value and the format. The format strings available can be found here.

  • yyyy : Year
  • MM : Month
  • dd : Day
  • HH : Hour (HH for 24 hours format and hh for 12 hours format)
  • mm : Minute
  • ss : Seconde

Here is an example:

[datetime]::ParseExact("20181010134412",'yyyyMMddHHmmss',$null)

Output:

October 10, 2018 1:44:12 PM

This method accept different values as input

OverloadDefinitions
-------------------
static datetime ParseExact(string s, string format, System.IFormatProvider provider)
static datetime ParseExact(string s, string format, System.IFormatProvider provider, System.Globalization.DateTimeStyles style)
static datetime ParseExact(System.ReadOnlySpan[char] s, System.ReadOnlySpan[char] format, System.IFormatProvider provider, System.Globalization.DateTimeStyles style)
static datetime ParseExact(string s, string[] formats, System.IFormatProvider provider, System.Globalization.DateTimeStyles style)
static datetime ParseExact(System.ReadOnlySpan[char] s, string[] formats, System.IFormatProvider provider, System.Globalization.DateTimeStyles style)
Result

Now I can just convert the date string into an actual DateTime object using Select-Object. Using a hash table with Name and Expression keys. The value of the Expression key is a script blocks that gets the Date property of each log entry (line) and convert them using the ParseExact method we saw above.

import-csv .\ScriptExample-20181002134401.log -Delimiter ';' -header 'Date','Type','Message' |
Select-Object -Property @{
    Name='Date';
    Expression={
        [datetime]::ParseExact($($_.date),'yyyyMMddHHmmss',$null)}
    },Type,Message

Output:

Date                  Type Message
----                  ---- -------
2018-10-02 1:44:01 PM INF  +----------------------------------------------------------------------------------------+
2018-10-02 1:44:01 PM INF  Script fullname          : C:\FX\script_example.ps1
2018-10-02 1:44:01 PM INF  Current user             : DEMOCOMP\FX
2018-10-02 1:44:01 PM INF  Current computer         : DEMOCOMP
2018-10-02 1:44:01 PM INF  Operating System         : Microsoft Windows 10 Entreprise 2016 LTSB
2018-10-02 1:44:01 PM INF  OS Architecture          : 64 bits
2018-10-02 1:44:01 PM INF  +----------------------------------------------------------------------------------------+
2018-10-02 1:44:01 PM INF  Connect to database 'SQLSERVER01'
2018-10-02 1:44:01 PM INF  Create splatting
2018-10-02 1:44:01 PM INF  Append parameters

Screenshot in action:

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 
LazyWinAdmin by François-xavier Cat - 10M ago

Dans le cadre du Hacktoberfest qui ce tient pendant le mois d’Octobre, nous organisons un mini-meetup pour démontrer les différentes façons de contribuer a des projets Open Sources sur Github.

Les démos seront évidemment concentrées sur les projets PowerShell de la communauté.

Hacktoberfest ?

Hacktoberfest - présenté par DigitalOcean en partenariat avec GitHub est une célébration d’un mois du logiciel libre. Les maintainers sont invités à guider les contributeurs potentiels vers les questions qui aideront à faire avancer le projet, et les contributeurs ont la possibilité de contribuer aux projets qu’ils aiment et à ceux qu’ils viennent de découvrir. Aucune contribution n’est trop petite - les corrections de bogues et les mises à jour de la documentation sont des moyens valables de participer.

Des prix a gagner ?

Hacktoberfest Note: Gagner un t-shirt sympa si vous faites aux minimum 5 pull requests sur nimporte quel repo public.

[Microsoft] se joint egalement a la célébration. Meme chose, gagner un t-shirt si vous faites une contribution sur un de leur repos :-) https://open.microsoft.com/2018/09/18/hacktoberfest-2018-microsoft/

Agenda
  1. Intro Hacktoberfest/Open Source
  2. Atelier - Comment contribuer
  3. Demos de Projets (partager votre projet/demo de 2-3min)
  4. Hack time!
Lien du meetup

https://meet.lync.com/lazywinadm/fxaviercat/7TZ703G3 (Avertissement: Pendant cette rencontre tous les écrans partagés sont enregistrés ainsi que tout ce que disent les participants)

Code de conduite

Please read our Events Code of Conduct (http://do.co/hacktoberconduct) before attending. Happy hacking!

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 
LazyWinAdmin by François-xavier Cat - 1y ago

I’m very pleased and honored to receive the MVP award for another year for the category Cloud and DataCenter Management MVP !

Dear Francois-Xavier,
We’re once again pleased to present you with the 2018-2019 Microsoft Most Valuable Professional (MVP) award in recognition of your exceptional technical community leadership. We appreciate your outstanding contributions in the following technical communities during the past year: Cloud and Datacenter Management

I want to thank everyone for their support and congratulate all the new/renewed MVPs

See my Microsoft MVP profile here.

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview