Hi all,
I have written a script which generates an argument set for an IBM application called Cognos which produces data cubes. My script produces a set of strings in the format -
-nologo -n -c -g -f’\dfsnamespace-Path\Preferences.xml’ -m’\dfsnamespace-Path\PPC005.mdl’
The unc paths are abstracted by DFS in Active Directory.
I am testing this on my workstation, the final plan will be for it to run on a clustered scheduling 2012 Server, and the final action is to create a remote session to the Cognos application server which will then run the command line generated. So my script creates a variable $CommandLineArgs containing a string like the one above
If I run the following in the shell it works (the Cogtr.exe executable has been added to the Path Environment variable on the app server)
$CommandLineArgs = "-nologo -n -c -g -f'\\dfsnamespace-Path\Preferences.xml' -m'\\dfsnamespace-Path\PPC005.mdl'" Enter-PSSession -ComputerName PPCLive01.mydomain.co.uk -Credential $Cred -Authentication Credssp Invoke-Expression ("Cogtr.exe "+ $CommandLineArgs) Exit-PSSession
But if I put exactly the same lines of code in a script then I get the error, I have tried putting the full path
Cogtr.exe : The term ‘Cogtr.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.
At line:1 char:1
Any help would be enormously appreciated. I am assuming that the script is not attempting to run the Cogtr.exe on the server, but on my Workstation.
Thanks
Andy