I'm using SqlServer module for powershell( https://www.powershellgallery.com/packages/SqlServer/21.1.18256) and I'm trying to use Invoke-ASCmd with -Credential parameter. The problem is, -Credential parameter is ignored and the current user for whom the powershell is started is used. When I start powershell with the user I want to use for -credential, it works fine.
Official docs say(https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-ascmd?view=sqlserver-ps): " -Credential If this parameter is specified, the user name and password passed will be used to connect to specified Analysis Server instance. If no credentials are specified default windows account of the user who is running the tool will be used."
But it does not work that way.
$pwd=ConvertTo-SecureString "something" -AsPlainText -Force
$mycred = New-Object System.Management.Automation.PSCredential("someusername",$pwd)
Invoke-ASCmd -Server "someServer.somewhere" -Credential $mycred -InputFile "C:\path\to\xmla\1.xmla"
Any ideas on how to fix this?