Introducing the Chocolatey Remote Management PowerShell GUI
One of the things I love doing with Chocolatey is pushing out packages to my Windows clients remotely. With PowerShell remoting, I can do this myself and it works well but for help desk staff who do not use PowerShell regularly, this is a challenge. To help with this, I created a very simple PowerShell GUI that can help manage Chocolatey clients with a few buttons.
To launch the GUI, I included a cmdlet in my Chocolatey-tools PowerShell module (available on Github and in the PSGallery) called Start-ChocoRemoteMgmt. This cmdlet only has two parameters, ComputerName and Packages. ComputerName will be the list of computer names that will be available for autocomplete in the GUI and packages is a list of Chocolatey package names available to choose from in a list box.
As an example, here I use Active Directory to get a list of all computers which will populate the computer list in the GUI. I also use the function Get-ChocoSourcePackages to get all of the packages from my the local sources I have configured in Chocolatey on the machine running Start-ChocoRemoteMgmt. Note that it will only get unique package names.
Start-ChocoRemoteMgmt -ComputerName (Get-ADComputer -Filter * | Select-Object -ExpandProperty Name) -Packages (Get-ChocoSourcePackages -Packages myrepo1,myrepo2,myrepo3)
The Install, Upgrade and Uninstall buttons are used with a selected package from the “Packages” list to perform that action on the computer in the Computer Name text box. In addition the “show outdated” and “show installed” buttons are used to simple show outdated or installed packages on the computer in the Computer Name text box. There are two buttons under the Computer Name text box for rebooting a computer and showing the current user.
Under the hood, this cmdlet is using PowerShell remoting with the Invoke-CommandAs community module (created by Marc Kellerman). This is for two reasons. Two use the SYSTEM account to run Chocolatey commands and to also work around the double-hop issue in case your Chocolatey repositories are using SMB shares. Here is the PowerShell code running from the “Install” button on the GUI:
$chocoutput = Invoke-CommandAs -AsSystem -ComputerName $ComputerList.Text -ScriptBlock { choco install $args[0] -y -r } -ArgumentList $PackageList.SelectedItem
Any action made in the GUI will show output in the “Output” box.
This is an initial release, so the GUI can definitely use a face lift. I am contemplating moving this to WPF or the Universal Dashboard perhaps in the future, but for now this should work. I am also aware that the Chocolatey folks plan on adding functionality similar to this in the Chocolatey Central Management console, although that requires a license.
Cool!
Do you know about Deployify? Also remote management, but from a website.
I have not until now but this seems pretty interesting. Thanks!