Private/Get-DirContent.ps1
|
function Get-DirContent { param ([string] $Path) $CurrentFunction = Get-FunctionName Write-Log -Message "### Start Function $CurrentFunction ###" $StartRunTime = (Get-Date).ToString($Script:DateFormatLog) #################### main code | out- host #################### Write-Host "" Write-Host -NoNewline " Command: " Write-Highlight -Text ("Get-ChildItem ", "-Path ", $Path) -Color $fgcC, $fgcS, $fgcV Write-Host "" Try { Get-ChildItem -Path $Path -ErrorAction Stop | Out-Host } Catch { Invoke-Output -T Error -M "No access to path $Path" } Write-Log -Message " >> using Get-ChildItem -Path $Path -Directory" ######################## main code ############################ $runtime = Get-RunTime -StartRunTime $StartRunTime Write-Log -Message " Run Time: $runtime [h] ###" Write-Log -Message "### End Function $CurrentFunction ###" } |