Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Invoke-Expression from global PowerShell script
-
Hi,
I'm trying to call stored on the server powershell script from buildmaster's global powershell script using Invoke-Expression, but getting error:
The term 'C:\Path\To\PowerShell\script.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.
I've also tried another ways to run it, such as:
Invoke-Expression C:\Path\To\PowerShell\script.ps1
. C:\Path\To\PowerShell\script.ps1
& C:\Path\To\PowerShell\script.ps1
C:\Path\To\PowerShell\script.ps1Each of them cause the same error.
Could you clarify how can I call stored on disk external ps1 script from BuildMaster's powershell script?
Product: BuildMaster
Version: 6.0.4
-
Are you sure you're using the right server context when calling the BuildMaster Powershell Asset? If you print out the server name in your asset using
$env:computername
do you get back the expected server? If I create a simple plan##AH:UseTextMode for server $MyServer { PSCall GLOBAL::Test_Powershell_Asset; }
Where my powershell asset is defined as this one-liner
Invoke-Expression C:\Path\To\PowerShell\script.ps1
Then I am able to run this script, no problem.