Search code examples
powershelluser-interfacelaunch

launching a ps1 file within a ps1 tool


Hi i have created a tool which launches central troubleshooting apps, but i have recently created another tool ps1 file and i cannot seem to get it to launch from the other tool

function LaunchQuickNotes {

try { 
    Start-Process -filePath "\\c\s\CAF1\ITSC Second Line Support\Craig Heckles Team\GUI\Admin Tool\QuickNotes Tool\QuickNotes tool - Tier 1.ps1" -
    LogWrite "Quick Notes launched" 
} 
catch {
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup("Unable to launch Quick Notes.",0,"Error",0)
}

i it seems to just open the .txt file and not launch in powershell.

Any suggestions


Solution

  • instead of

    Start-Process -filePath "\\c\s\CAF1\ITSC Second Line Support\Craig Heckles Team\GUI\Admin Tool\QuickNotes Tool\QuickNotes tool - Tier 1.ps1" -
    

    try

    powershell.exe -f "\\c\s\CAF1\ITSC Second Line Support\Craig Heckles Team\GUI\Admin Tool\QuickNotes Tool\QuickNotes tool - Tier 1.ps1"