calling function remotely


when this:

function doanything()

{

ls;

}

 

invoke-command -computername $servidor -credential $credential -scriptblock { doanything }; 

 

 

i receivid error:

the term 'doanything' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path 

was included, verify path correct , try again.

    + categoryinfo          : objectnotfound: (doanything:string) [], commandnotfoundexception

    + fullyqualifiederrorid : commandnotfoundexception

 

 

so, how can invoke function remotely?

 

  invoke-command -computername $servidor -credential $credential -scriptblock {    function doanything   {ls}   doanything }  



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2