Forum Discussion
Feb 09, 2024
Get-StartApps : The term 'Get-StartApps' is not recognized as the name of a cmdlet, function, script
I have a command such as
(Get-StartApps | Where-Object name -eq 'Notepad').AppId
or just simply
Get-StartApps
which works just fine via PowerShell ISE.
I, on the other h...
- Feb 11, 2024
The only suggestion I have now is replacing your "powershell.exe" statement with a full path alternative of:
C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe
Cheers,
Lain
Feb 10, 2024
No one?
Feb 10, 2024
Get-StartApps is part of the StartLayout module; you could try to import-module StartLayout first.?
Something like this: (Added -noprofile for possible faster loading)
CreateObject("WScript.Shell").Run "powershell -executionpolicy RemoteSigned -noprofile -command ""Import-Module StartLayout ; Get-StartApps | Where-Object name -eq 'Notepad';Start-Sleep -Seconds 8;""", 1, True
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If one of the posts was helpful in other ways, please consider giving it a Like.
- Feb 10, 2024Adding the Import now generates the following error
Import-Module : The specified module 'StartLayout' was not loaded because no valid module file was found in any module
directory.
At line:1 char:1
+ Import-Module StartLayout;$ToastHeader = New-BTHeader -Title 'Plannin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (StartLayout:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Get-StartApps : The term 'Get-StartApps' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:225
+ ... \Databases\icons\agenda-153555_640.png' -AppId (Get-StartApps | Where ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-StartApps:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException- Feb 10, 2024Try this?
CreateObject("WScript.Shell").Run "powershell -executionpolicy RemoteSigned -noprofile -command ""Install-Module StartLayout; Install-Module StartLayout ; Get-StartApps | Where-Object name -eq 'Notepad';Start-Sleep -Seconds 8;""", 1, True- Feb 11, 2024but then that requires Admin rights, so that's a no go.
Really odd, that it works fine in the ISE, but not run from cmd...