Show me your profile !

Presentation of the different PowerShell profiles

Show me your profile ! Information This article was written for a presentation of the French Powershell UserGroup This presentation can be seen on Youtube on the FRPSUG channel What is a profile? Obviously this is the first question we can ask ourselves ;-) A PowerShell profile is simply a script: with a special name which is in a special directory which runs when PowerShell starts The (or rather) profile is used to customize your environment: [Read More]

Parameter validation

Validating parameters in a Powershell function

Parameter validation In this article we will talk about an option available in Powershell: the validation of parameters The purpose of this option is, as the name suggests, to validate that a parameter passed to a function is indeed the one we expect. Throughout this article we will keep the following script as a guideline. function Do-SomeThing { [CmdletBinding()] param ( [String[]]$ComputerName, [Int]$Age ) begin { #The value of computername must not be null or empty if (($null -eq $ComputerName) -or ($ComputerName -eq "")) { throw "ComputerName cannot be empty or null" } #Test to verify that the computer name does not exceed 13 characters If ($ComputerName. [Read More]

Scope of variables

The different scopes for the variables used in Powershell

Information This article was written for a presentation of the French Powershell UserGroup. This presentation can be seen on Youtube on the FRPSUG channel The scope of variables in Powershell Several scopes are possible for the use of variables according to need Some basic rules: An element that you include in a scope is visible in the scope in which it was created and in any child scope, unless you explicitly make it private If you create an element in a scope and the element shares its name with an element in another scope, the original element can be hidden under the new element. [Read More]

Credential: how to use them ?

The different ways to use credentials

Information This article was written for a presentation of the French Powershell UserGroup. This presentation can be seen on Youtube on the FRPSUG channel The different ways to use credentials… Initial Request From my beginnings on powershell, I quickly asked myself the question of managing credentials in my scripts From the simple need that is perhaps managed in a basic way to the use of credentials in automatic scripts I have long sought the best way to do it. [Read More]

Credential: how to best use them ?

The module BetterCredentials

Information This article was written for a presentation of the French Powershell UserGroup. This presentation can be seen on Youtube on the FRPSUG channel Module : BetterCredentials During my last research, I came across, by chance, the module BetterCredentials from Jaykul Please note that the module is not completely dry :-) As he says himself so well ;-) The goal of BetterCredentials is to provide a Get-Credential command fully compatible with previous versions that improves the original Get-Credential by adding additional functionality that is not present in the integrated command. [Read More]

State of synchronization between inventory and supervision

Have a state of synchronization between its inventory and its supervision

Have a state of synchronization between its inventory and its supervision Initial Need I use the following tools every day: Centreon for supervision Glpi for my inventory Unfortunately I am not the only one to manage and create servers by cons I am the only one to manage the supervision. Naturally as always in this kind of case it often happens that servers are created without my being informed and suddenly a de-correlation between the supervision and the inventory appears. [Read More]

Word: cutting a Word file

Cut a file and save it in several documents

Cut a Word file into several PDFs… Initial Request The initial request which led me to reflect on this subject came from a colleague. My colleague receives a large Word document from his ERP containing on each page a letter for a different recipient. In order to be able to integrate it into EDM (Electronic Document Management) he had the following needs: Cut the large file into several files (1 page = 1 file) Retrieve data from documents to name the PDF Save new documents in PDF Not knowing much about manipulating Word via PowerShell, I cut my thinking, as usual, into small steps. [Read More]