I have big problem when trying to execute a PowerShell function which is in another file.
This is my initial .ps1 file:
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$file = Get-Item $scriptDir\JSONFile1.json
$plaintext = $file | Get-Content
.\Functions\Add-Folder.ps1 -AdlsAccountName "Hello World"
The file Add-Folder.ps1
consists of the following content:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string] $AdlsAccountName
)
Write-Host $AdlsAccountName
But when i execute this .ps1 script i receive the following error:
##[error]The term '.\Add-Folder.ps1' 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.