suddenly powershell stopped working while deploying via build

ACDBA 1 Reputation point
2021-01-19T11:45:59.803+00:00

We were having a build which used to deploy ssas though 'Invoke-ASCmd' . This build was working fine with out issues.All of us sudden it stopped working. But when we manually execute ps1 it works. There is no change in Group policy. required modudle sqlserver is already in place. what could be the reason. there are other ps1 scripts on the same build is working fine.But they dont have asccmd. where should i check?

[000357][01:58:34:0167] [7][MicroActions.ReadStreamOutput]GAC Version Location
[000358][01:58:34:0167] [7][MicroActions.ReadStreamOutput]--- ------- --------
[000359][01:58:34:0167] [7][MicroActions.ReadStreamOutput]True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.AnalysisServices.AdomdClient\v4.0_15.0.0....
[000360][01:58:34:0167] [7][MicroActions.ReadStreamOutput]ABC
[000361][01:58:35:0589] [7][MicroActions.ReadStreamOutput]Invoke-ASCmd : The term 'Invoke-ASCmd' is not recognized as the name of a cmdlet, function, script file, or operable
[000362][01:58:35:0589] [7][MicroActions.ReadStreamOutput]program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
[000363][01:58:35:0589] [7][MicroActions.ReadStreamOutput]At C:\Program Files (x86)\SetConnectionString.ps1:47 char:1
[000364][01:58:35:0589] [7][MicroActions.ReadStreamOutput]+ Invoke-ASCmd -Query $query -Server $analysisServer
[000365][01:58:35:0589] [7][MicroActions.ReadStreamOutput]+ ~~~~~~~~~~~~
[000366][01:58:35:0589] [7][MicroActions.ReadStreamOutput] + CategoryInfo : ObjectNotFound: (Invoke-ASCmd:String) [], CommandNotFoundException
[000367][01:58:35:0589] [7][MicroActions.ReadStreamOutput] + FullyQualifiedErrorId : CommandNotFoundException
[000368][01:58:35:0589] [7][MicroActions.ReadStreamOutput]
[000369][01:58:35:0620] [16][MicroActions.ExecutePowerShellCommand]Process exited with code: 0
[000370][01:58:35:0620] [15][MicroActions.SetCubeConnectionString][DeploySSASServer]Success
[000371][01:58:35:0620] [14][MicroActions.CreateDatabase]CreateDatabase(Success)

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,404 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 31,091 Reputation points Microsoft Vendor
    2021-01-20T09:24:24.297+00:00

    Hi,

    The error message means the module sqlserver was not imported. Try adding Import-Module sqlserver to the beginning of the script and see if it works. If not, run Get-Module -Name sqlserver | select path and make sure the user who ran the script can access the path. The path is %ProgramFiles%\WindowsPowerShell\Modules by default.

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments