I am trying to pass value for argument in below command script called install.ps1. I execute it by ./install.ps1 HD1
invoke-command -Session $session -ScriptBlock {G:\usr\sap\$($args[0])\hdbclient\hdbuserstore.exe list}
but it gave an error to me that
The term 'G:\usr\sap\$($args[0])\hdbclient\hdbuserstore.exe' 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. + CategoryInfo : ObjectNotFound: (G:\usr\sap\$($a...dbuserstore.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException + PSComputerName : hostname
($args[0])
is supposed to contain? It is passed as string literal, not expanded variable, so the OS is looking for wrong path. – vonPryz