0

Getting no output from the below code:

PS C:\WINDOWS\System32> $PWD = import-Clixml -path "C:\BCBS\cred.xml";
    $BTEQ
    ".logon dbname\username,$PWD
      select infokey from dbc.dbcinfo
    .logoff"
    $BTEQ| bteq 
 
   ## $BTEQ
  
.logon dbname\username,System.Management.Automation.PSCredential
      select infokey from dbc.dbcinfo
    .logoff
BTEQ 16.20.00.07 (32-bit) Thu Feb 25 08:46:56 2021 PID: 16336
 
+---------+---------+---------+---------+---------+---------+---------+----
 *** BTEQ exiting due to EOF on stdin.
 *** Exiting BTEQ...
 *** RC (return code) = 0 
Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
mat
  • 1
  • 1
  • 1
    It doesn't look like you're passing any input to `bteq`. Did you mean to write `$BTEQ = ".logon ..."`? – Mathias R. Jessen Feb 25 '21 at 15:10
  • 4
    Do not use `$PWD` as self-defined variable name because it is an [Automatic variable](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7#pwd): _Contains a path object that represents the full path of the current directory._ – Theo Feb 25 '21 at 15:11
  • Thanks.. I've made the changes. $pd = import-Clixml -path "C:\BCBS\cred.xml"; $BTEQ = ".logon ptdbia\a0s0m9,$pd ; select infokey from dbc.dbcinfo; .logoff" $BTEQ| bteq – mat Feb 25 '21 at 16:40
  • +---------+---------+---------+---------+---------+---------+---------+---- .logon dbname\username, *** BTEQ exiting due to EOF on stdin. *** Exiting BTEQ... bteq : *** CLI error: MTDP: EM_NOHOST(224): name not in HOSTS file or names database. At line:5 char:12 + $BTEQ| bteq + ~~~~ + CategoryInfo : NotSpecified: ( *** CLI error:...names database.:String) [], *** Return code from CLI is: 224 *** Error: Logon failed! *** RC (return code) = 8 – mat Feb 25 '21 at 16:44

0 Answers0