Invoke-ASCmd Caches xmla?

tldr: Invoke-ASCmd caches xmla files somewhere. Always provide the absolute path to Invoke-ASCmd -InputFile.

Struggling with Invoke-ASCmd, I found changes made to an xmla file weren't taking effect in Azure Analysis Services, despite a lack of errors.

Bring up a fresh AAS & powershell session gave me no joy until I spotted something odd...

PS C:\joseph-tmp> Invoke-ASCmd -InputFile ".\foo.xmla" -Server $AASServer
<return xmlns="urn:schemas-microsoft-com:xml-analysis">
    <root xmlns="urn:schemas-microsoft-com:xml-analysis:empty"></root>
</return>
PS C:\joseph-tmp> mv foo.xmla foo24.xmla

PS C:\joseph-tmp> Invoke-ASCmd -InputFile ".\foo24.xmla" -Server $AASServer
Invoke-ASCmd : InputFile ".\foo24.xmla" not found
At line:1 char:1
+ Invoke-ASCmd -InputFile ".\foo24.xmla" -Server $AASServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-ASCmd], FileNotFoundException
    + FullyQualifiedErrorId : DataValidation,Microsoft.AnalysisServices.PowerShell.Cmdlets.ExecuteScriptCommand

Huh... the file is definitely there:

PS C:\joseph-tmp> dir


    Directory: C:\joseph-tmp


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        8/12/2019  10:19 AM          80051 foo24.xmla

Pretty sure I know how to point it to a file but lets be sure...

PS C:\joseph-tmp> Invoke-ASCmd -InputFile "foo24.xmla" -Server $AASServer
Invoke-ASCmd : InputFile "foo24.xmla" not found
At line:1 char:1
+ Invoke-ASCmd -InputFile "foo24.xmla" -Server $AASServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-ASCmd], FileNotFoundException
    + FullyQualifiedErrorId : DataValidation,Microsoft.AnalysisServices.PowerShell.Cmdlets.ExecuteScriptCommand

PS C:\joseph-tmp> Invoke-ASCmd -InputFile foo24.xmla -Server $AASServer
Invoke-ASCmd : InputFile "foo24.xmla" not found
At line:1 char:1
+ Invoke-ASCmd -InputFile foo24.xmla -Server $AASServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-ASCmd], FileNotFoundException
    + FullyQualifiedErrorId : DataValidation,Microsoft.AnalysisServices.PowerShell.Cmdlets.ExecuteScriptCommand

...still no joy...

PS C:\joseph-tmp> Invoke-ASCmd -InputFile ".\foo.xmla" -Server $AASServer
<return xmlns="urn:schemas-microsoft-com:xml-analysis">
    <root xmlns="urn:schemas-microsoft-com:xml-analysis:empty"></root>
</return>

...but that file doesn't even exist any longer?! What about...

PS C:\joseph-tmp> Invoke-ASCmd -InputFile c:\joseph-tmp\foo24.xmla -Server $AASServer
<return xmlns="urn:schemas-microsoft-com:xml-analysis">
    <root xmlns="urn:schemas-microsoft-com:xml-analysis:empty"></root>
</return>

It works! It turns out Invoke-ASCmd has some sort of caching built in. If you specify a relative filename, this seems to be invoked.

Use absolute paths.