Hello,
My script looks like this:
cls $RemoteServer = "zserver101" $WorkItemID = "202" $WorkItemState = "Stage to CONS" Function LoglinesSmall { Write-Host "" Write-Host " -------------------" Write-Host "" } $script = { param ($WorkItemID, $WorkItemState) #Region ########################## Get environment and state variable's ########################## $Staging_Directory = "c:\StagerTemp\" $Servername = $env:COMPUTERNAME $Currentuser = [Environment]::UserName Write-Host "Get environment and state to variable" Write-Host "Current Username: " $Currentuser Write-Host "Work Item ID: "$WorkItemID Write-Host "Work Item State: "$WorkItemState $filevalue = "Current Username: " +$Currentuser +";Servername: "+$Servername New-Item c:\test_psscript.txt -ItemType File -value $filevalue -Force LoglinesSmall } Invoke-Command -ComputerName $RemoteServer ` -ScriptBlock $script ` -ArgumentList $WorkItemID, $WorkItemState ` -ErrorAction Stop
I get an error:
The term 'LoglinesSmall' 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.
How can I call the function LoglinesSmall from target script at invoke-command?
Thanks Horst MOSS 2007 Farm; MOSS 2010 Farm; TFS 2010; IIS 7.5