====== PowerShell : Fonction ======
===== FilePath =====
function This-IsYourFunction
{
Param
(
[Parameter(Mandatory=$true)]
[ValidateScript({Test-Path $_})]
[string]
$filePath
)
Write-Host "Hello, World."
}
function Install-Office {
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipelineByPropertyName)]
[ValidateSet('2013','2016')]
[string]$Version,
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateNotNullOrEmpty()]
[string]$ComputerName
)
process {
<#
## Connect to the remote with some code here
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
## Do stuff to install the version of office on this computer
Start-Process -FilePath 'msiexec.exe' -ArgumentList 'C:\Setup\Office{0}.msi' -f $using:Version
}
#>
Write-Host "I am installing Office version [$Version] on computer [$ComputerName]"
}
}