Custom script template with powershell and sqlplus

Custom script template with powershell and sqlplus

hi,

Tried the following in the Powershell console and it works:
$sqlQuery = get-content "D:\Scripts\sqlquery.txt";
$tnsalias = "tnsalias";
$username = "username";
$password = "password";
$sqlOutput = $sqlQuery | sqlplus -silent $username/$password@$tnsalias;


Tried the same with Opmanager and failed:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM " http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="thresholdEnabled">false</entry>
<entry key="executeFrom">0</entry>
<entry key="interval">5</entry>
<entry key="monitorName">Count</entry>
<entry key="commandLine">cmd /c powershell.exe -ExecutionPolicy RemoteSigned .\${FileName}.ps1 svchost.exe</entry>
<entry key="yaxisText">counts</entry>
<entry key="workingDir">${TempDir}</entry>
<entry key="version">2</entry>
<entry key="scriptBody">$sqlQuery = get-content "D:\Scripts\sqlquery.txt";
$tnsalias = "tnsalias";
$username = "username";
$password = "password";
$sqlOutput = $sqlQuery | sqlplus -silent $username/$password@$tnsalias;
Write-Host "Data:";
$sqlOutput;
exit 0;</entry>
<entry key="timeout">10</entry>
<entry key="monitorDescription">Powershell and SQLPlus script to get count</entry>
</properties>

=================================================================


Thanks and regards,
Kenny
              New to ADManager Plus?

                New to ADSelfService Plus?