I just published a new module to integrated with Windows. Execute PowerShell from desktop shortcuts, global hotkeys, context menus and file associations.
This is awesome! Thanks for more extremely useful tools Adam!
This looks great! Iâd love to use something like this to push out custom and rapidly updatable functionality to our managed staff workstations. Is there a way to customize the tray icon and remove the Edit Config and Exit options from the tray context menu?
Hi @sandy,
Youâll be able to edit the icon in 1.0.3 so not in the current version but the next.
You can hide the exit and edit config menu items with -HideExit and -HideConfig on New-CommanderToolbarIcon
Thanks @Adam ! This might be a perfect solution for us. Thanks for coming up with all these awesome tools!
Hey @Adam , another thing I think could be really helpful is the ability to make dynamic submenus. For example, if I could make an API call and update a submenu based on the result. Is that something feasible or on the roadmap?
For example, if I manage user permissions for network shares in a centralized application, I could then have a submenu that lists all the network shares that can be mounted. If I add a new network share, it could show up automatically as an option in the tray icon menu.
Thanks!
You can use the -LoadMenuItems parameter of New-CommanderMenuItem to do this. PSCommander - PowerShell Pro Tools
That script block is invoked as the menu is opened so that you could load those dynamically.
Seemed like a good tool, I installed it right away.
Followed along with the video and worked fine.
I canât get âEdit Configâ to bring up the config.ps1 file. PSScriptPad doesnât start.
PSScriptPad is in my path, if I go to powershell and type in psscriptpad it starts right up.
This is happening on 3 machines.
Did you install it to the AllUsers scope?
We are tracking an issue where it seems like the config file wonât open in that case: PSCommander - Program Files install fails to open config file ¡ Issue #89 ¡ ironmansoftware/issues ¡ GitHub
Other than that, I would recommend to work around this, you can create a file here:
$documents = [Environment]::GetFolderPath('MyDocuments')
$Folder = [IO.Path]::Combine($documents, "PSCommander")
$File = [IO.Path]::Combine($Folder, "config.ps1")
PSCommander doesnât actually require the use of PSScriptPad and should refresh itâs configuration whenever the file is edited.
EDIT: Weâll be releasing a fix for this issue as soon as our expired code signing certificate has been renewed.
I did install it to AllUsers
Ok. Yeah, youâre running into that bug then. You should be able to open the file in your documents folder manually and edit from there.
I just added this which works great.
New-CommanderMenuItem -Text âEdit Config *â -Action {
$Documents = [Environment]::GetFolderPath(âMyDocumentsâ)
$Folder = [IO.Path]::Combine($Documents, âPSCommanderâ)
code $Folder
}
This tool looks great.
Can we use a string of keystrokes for the Global Hot Key feature? I used to us AutoHotKey for things like expanding "mye " and "myp " into my email address and phone number respectively, or "vni " which would expand into a âvendor, not interestedâ template email pulling the recipientâs name into the header.
But AHK started to lag and having the power of PS would be amazing.
Not possible at the moment but I love this idea. Let me play around with it.
Which version of PS is it running?
Can it run PS7?
It uses PowerShell 7. It uses the PS7 SDK and embeds the host.
I have some modules I use everyday in my default powershell.
I expect I would need to import them before running any cmdlet in them.
New-CommanderMenuItem -Text 'Default Reports' -Action {
Import-Module DevOps.Config
Import-Module DevOps.Credentials
Import-Module DevOps.Utilities
Import-Module DevOps.Reports
Get-DefaultReports
}
Not sure this is correct, but if it is it doesnât seem to be working.
Seems correct. Can you try to see if itâs throwing an error and not reporting it for some reason?
New-CommanderMenuItem -Text 'Default Reports' -Action {
try
{
Import-Module DevOps.Config -ErrorAction Stop
Import-Module DevOps.Credentials -ErrorAction Stop
Import-Module DevOps.Utilities -ErrorAction Stop
Import-Module DevOps.Reports -ErrorAction Stop
Get-DefaultReports
} catch { $_ | Out-String | Out-File C:\temp.txt }
}
Thanks for the tip, did find something on my part.
Will fix that and see how it goes.
Thanks