I'm trying to the following powershell script in cmd. Here's a trivial example:
$path = "c:\"
cd $path
ls
Some PowerShell script of multiple lines and with quotation marks.
I read this post and @Alex's answer in this post, but putting multiple lines together with ;
between them didn't work:
C:\Users\abcd>powershell "&c:\ ; ls" & : The term 'c:\' 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:1 char:2 + &c:\ ; ls + ~~~ + CategoryInfo : ObjectNotFound: (c:\:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS: My actual task is to run the following (I provided the trivial task above, since not everyone has the database).
$tabular_server = "abc_123\Tabular"
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect($tabular_server)
$db = $server.Databases.Item("db_name")
$db.Process("ProcessClear")
$db.Process("ProcessDefault")
$server.Disconnect()