We help IT Professionals succeed at work.
Get Started

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

bibi92
bibi92 asked
on
73 Views
Last Modified: 2016-01-12
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
Comment
Watch Question
"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE