Private/Start-NetSess.ps1
|
function Start-NetSess { Param([string]$server) $CurrentFunction = Get-FunctionName Write-Log -Message "### Start Function $CurrentFunction ###" $StartRunTime = (Get-Date).ToString($Script:DateFormatLog) #################### main code | out- host ##################### $program = Join-Path -Path $PSScriptRoot -ChildPath "NetSess.exe" & $program $server #Invoke-Command -ScriptBlock { .\NetSess.exe $server } Write-Log -Message " >> Using DC $server!" ######################## main code ############################ $runtime = Get-RunTime -StartRunTime $StartRunTime Write-Log -Message " Run Time: $runtime [h] ###" Write-Log -Message "### End Function $CurrentFunction ###" } |