1
Function Import-ibd

 {
    [cmdletbinding()]

    param

    (
        [string]$SiteID = $env:SITENUMBER, #pull envvar sitenumber and puts it as "siteid"
        [string]$Username = 'username',
        [string]$Password = 'password', 
         [string]$ImportID = 'ID of import' 
    )

    $Result = Start-Process -FilePath 'c:\path to the \.exe ' `
        -ArgumentList "/User $Username /Password $Password /SiteID $env:SITENUMBER /ImportID $ImportID /ContextSiteID $SiteID" -Wait -PassThru -NoNewWindow

 }
 Import-ibd

the CMD format for the command is " c:\path to.exe /User Jadoe123 /Password 1234Abc! /SiteID BJ123/ImportID EOD123 ". the command calls the .exe with a username + passwords, passes a siteid and which function inside of the .exe to run. I can run that command listed above in CMD and it works, but I'm looking to convert to python

bott92
  • 11
  • 2
  • 1
    To synchronously execute console applications or batch files and receive their output, call them _directly_ (`& 'c:\path to\some.exe' ...`), do _not_ use `Start-Process` - see [this answer](https://stackoverflow.com/a/51334633/45375). – mklement0 May 21 '21 at 21:54
  • The linked duplicate hopefully shows you how to fix the problem in your _PowerShell_ code. It's unclear how Python relates to this; if the intent is to translate the PowerShell function to Python and you get stuck with that, please ask a _new_ question, focused just on that. – mklement0 May 21 '21 at 22:02

0 Answers0