I have below command, that I want to be called from my script, how can I pass the function New-PopupMessage
?
Start-Process $PSScriptRoot\ServiceUI.exe
-process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe
-noprofile -windowstyle hidden -executionpolicy bypass -command New-PopupMessage @Params
I also tried with a Invoke-command
Invoke-Command -ScriptBlock {
Start-Process $PSScriptRoot\ServiceUI.exe
-process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe
-noprofile -windowstyle hidden -executionpolicy bypass
-command ${function:New-PopupMessage} -ArgumentList @Params
}