start-Process doesn't work for executable with dll's

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
Patrick9999
Posts: 9
Last visit: Thu May 25, 2023 11:53 pm

start-Process doesn't work for executable with dll's

Post by Patrick9999 »

Product, version and build: Powershell Studio 2019
32 or 64 bit version of product: 64bit version 5.6.167.0 with update 1.1.33.0
Operating system: windows 10 Enterprise
32 or 64 bit OS: 64 bit

*** Please add details and screenshots as needed below. ***
I would like to run this exectable Process1.exe with next content
Start-Process -filePath "C:\Users\temp\MonInterface.exe"

the Process1.exe starts but Moninterface.exe is not started, but no errors seen.

MonInterface.exe script starts and works fine in correct folder C:\Users\temp\
can we upload .dll somewhere in Powershell studio?

Moninterface.ps1 script:
[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | out-null
[System.Reflection.Assembly]::LoadWithPartialName('presentationframework') | out-null
[System.Reflection.Assembly]::LoadFrom('assembly\MahApps.Metro.dll') | out-null


function LoadXml ($global:filename)
{
$XamlLoader=(New-Object System.Xml.XmlDocument)
$XamlLoader.Load($filename)
return $XamlLoader
}

$XamlMainWindow=LoadXml("MonInterface.xaml")
$Reader=(New-Object System.Xml.XmlNodeReader $XamlMainWindow)
$Form=[Windows.Markup.XamlReader]::Load($Reader)

$DataGrid_Machines = $form.FindName("DataGrid_Machines")
$DataGrid_Utilisateurs = $form.FindName("DataGrid_Utilisateurs")
$BTN_Redemarrer = $form.FindName("BTN_Redemarrer")
$BTN_Eteindre = $form.FindName("BTN_Eteindre")

Function Populate_Datagrid_Machines
{
$Machines_XML = [xml](get-content "Liste_Machines.xml")
$Liste_Machines = $Machines_XML.Ordinateurs.Ordinateur
ForEach ($Machine in $Liste_Machines)
{
$Machine_Valeur = New-Object PSObject
$Machine_Valeur = $Machine_Valeur | Add-Member NoteProperty Nom $Machine.Nom -passthru
$Machine_Valeur = $Machine_Valeur | Add-Member NoteProperty Localisation $Machine.Localisation -passthru
$Machine_Valeur = $Machine_Valeur | Add-Member NoteProperty OS $Machine.OS -passthru
$DataGrid_Machines.Items.Add($Machine_Valeur) > $null
}
}

Function Populate_Datagrid_Utilisateurs
{
$Utilisateurs_XML = [xml] (get-content "Liste_Utilisateurs.xml")
$Liste_Utilisateurs = $Utilisateurs_XML.Utilisateurs.Utilisateur
ForEach ($Utilisateur in $Liste_Utilisateurs)
{
$Utilisateur_Valeur = New-Object PSObject
$Utilisateur_Valeur = $Utilisateur_Valeur | Add-Member NoteProperty Nom $Utilisateur.Nom -passthru
$Utilisateur_Valeur = $Utilisateur_Valeur | Add-Member NoteProperty Localisation $Utilisateur.Localisation -passthru
$DataGrid_Utilisateurs.Items.Add($Utilisateur_Valeur) > $null
}
}

Populate_Datagrid_Machines
Populate_Datagrid_Utilisateurs

$Form.ShowDialog() | Out-Null




DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: start-Process doesn't work for executable with dll's

Post by Alexander Riedel »

I am not sure what you mean by "can we upload .dll somewhere in Powershell studio?"

If your application has dependencies, like a dll for example, you should consider making an MSI for distribution. There you would add the dll and any other needed files.
Keep in mind that Start-Process is not a PowerShell Studio thing, it is a Microsoft PowerShell Cmdlet, which more or less uses the CreateProcess API call.
I am not sure why you would run an application from a users temp folder either, so I am guessing there is a lot of information on this you didn't mention yet.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.