I am attempting to call another PS script B.ps1
which takes a parameter:
Invoke-Expression "C:\AzureFileShare\MEDsys\Powershell Scripts\B.ps1 -ServerName medsys-dev"
Then in B.ps1
:
Param([string]$ServerName)
...
...
When I attempt to execute Invoke-Expression
, I get the following error:
The term 'C:\AzureFileShare\MEDsys\Powershell' is not recognized as the name of a cmdlet, function, script file, or operable program.
I don't know why PowerShell is complaining about this since the B.ps1
script does actually exist in the referenced folder. Unless something else is wrong?
.\B.ps1 -parameter "Value"
You have to change your directory to B.ps1's location. – Vivek Kumar Singh