PSCommander - Command your desktop with PowerShell

I just published a new module to integrated with Windows. Execute PowerShell from desktop shortcuts, global hotkeys, context menus and file associations.

1 Like

This is awesome! Thanks for more extremely useful tools Adam!

1 Like

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!

1 Like

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.

@Adam :drooling_face:

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. :face_with_symbols_over_mouth:

1 Like

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
}

2 Likes

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 :slight_smile: 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