PowerShell with Include script not working

15 views
Skip to first unread message

Gavin Armitage (AU)

unread,
Jun 8, 2016, 2:32:00 AM6/8/16
to Jenkins Users
Need some advise,

I am running a powershell file with a include for another ps1 file. I am using a Windows bat command to run the file via powershell.exe. Please see below for the file details.

FunctionB.ps1

Function Get-ValueFortext()
{
 return "abc"
}

FunctionA.ps1

$ScriptPath = Split-Path $MyInvocation.InvocationName
& "$ScriptPath\FunctionB.ps1"

$valueFromText = Get-ValueFortext


The issue i get is the following

05:36:38 Get-ValueFortext : The term 'Get-ValueFortext' is not recognized as the name 
05:36:38 of a cmdlet, function, script file, or operable program. Check the spelling of 
05:36:38 the name, or if a path was included, verify that the path is correct and try
Reply all
Reply to author
Forward
0 new messages