Skip to content

Instantly share code, notes, and snippets.

View kayasax's full-sized avatar

Loïc MICHEL kayasax

  • Microsoft
  • France
View GitHub Profile
@kayasax
kayasax / parameters.ps1
Last active June 14, 2017 11:23
Exemple d'usage de PARAMETER
[CmdletBinding()] #make script react as cmdlet (-verbose etc..)
param(
[Parameter(Position=0, Mandatory=$true,ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$service,
[Parameter(Position=1)]
[System.string]
$computername="local"
@kayasax
kayasax / Powershell Script Template.ps1
Last active December 22, 2015 19:39
Template for powershell script. Makes all errors "terminating" and send mail if error occurs
# Templata.ps1
# author: Loic MICHEL
# date: 10/09/2013
# abstract: make all errors terminating errors and send email + raise event in case of failure
#
[CmdletBinding()]param(
)