Avatar of bibi92
bibi92
Flag for France

asked on 

'echolog' is not recognized as the name of a cmdlet if I execute the script remotely

Hello,

If I execute remotely from share a script which contain :
$SQLS='TEST'
$Db='db'
echolog : The term 'echolog' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
function echolog([string]$_Message,[string]$_ForeGround)
{
    $_Day=Get-Date -f yyyy/MM/dd
    $_Hour=Get-Date -f  HH:mm:ss
    if($itaas){
        Write-Host ("###LOG###;" +  $_Day + " " + $_Hour + " :: " + $_Message)
    }else{
        Write-Host "$_ScriptName - $_Day $_Hour :: LOG :: $_Message";
    }
    $_ScriptName + " - " + $_Day + " " + $_Hour + " :: LOG :: " + $_Message | Out-File $_LogFile -append;
}

echolog("Create database $Db (SQLServer : $SQLS)")

The following error is returned but not if I execute the script locally, why ?
'echolog' is not recognized as the name of a cmdlet

Thanks
Powershell

Avatar of undefined
Last Comment
Ben Hart

8/22/2022 - Mon