November 2018
Intermediate to advanced
566 pages
17h 15m
English
This capability will require a single change to the existing script. Follow these steps to get started:
function New-File {
[CmdletBinding(
ConfirmImpact='High',
SupportsShouldProcess=$true
)]
param (
# The path to the file (or the name)
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline)]
[string[]]
$Path
)
begin {
Write-Host "$(Get-Date)"
}
process {
foreach ($Item in $Path) {
if ($PSCmdlet.ShouldProcess("$PsScriptRoot", "Create $Path")) {
New-Item -Path $Item -ItemType File
}
}
}
end {}
}
Read now
Unlock full access