Any help is appreciated.
I am getting the error below when trying to execute the PowerShell script in Runbooks.
Invoke-ASCmd : The term 'Invoke-ASCmd' 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. At line:27 char:1 + Invoke-ASCmd -Query $TmslScript -Server: $XmlaEndpoint -Database $Dat ... + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Invoke-ASCmd:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
But when I execute the same script locally then it is successful.
I tried to install the SqlServer module using the script:
Install-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUser -SkipPublisherCheck -AllowClobber -Force
but it gave me the errors below.
Error 1:
Exception calling "ShouldContinue" with "2" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\Client\AppData\Roaming\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?" At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7455 char:8 + if($Force -or $psCmdlet.ShouldContinue($shouldContinueQueryMessag ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : HostException
Error 2:
Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed. At line:12 char:1 + Install-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUs ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Install-Module], InvalidOperationException + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module
So, I tried to install the NuGet package using the script:
Install-PackageProvider -Name NuGet -Scope CurrentUser -Force
but it gave me the error below:
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags. At line:11 char:1 + Install-PackageProvider -Name NuGet -Scope CurrentUser -Force + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
I tried installing the following scripts in succession hoping to resolve the issue:
PowerShell Install-PackageProvider -Name NuGet -Scope CurrentUser -Force
PowerShellInstall-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUser -SkipPublisherCheck -AllowClobber -Force
PowerShellInvoke-ASCmd -Query $TmslScript -Server: $XmlaEndpoint -Database $DatasetName