====== Powershell Tips, and examples ====== ===== Enabling, and using SSH with Powershell ===== https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse One quirk with using OpenSSH Server via Windows is that the authorized_keys file is used only for standard users. If the user you are trying to connect with is an admin, you have to use the administrator_authorized_keys file in ProgramData/ssh/ - https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration ===== Using vim as your editor in the command line ===== https://codeandkeep.com/PowerShell-And-Vim/ Install the windows vim application Create a powershell profile - https://www.howtogeek.com/50236/customizing-your-powershell-profile/ (note you may have an issue with creating a profile, Powershell may complain about restricting the use of running scripts. See here - thewindowsclub.com/powershell-file-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system) Add these alias lines inside the profile: New-Alias -Name vim -Value 'C:\Program Files (x86)\Vim\vim82\vim.exe' New-Alias -Name vi -Value 'C:\Program Files (x86)\Vim\vim82\vim.exe' More on profile locations - https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.2 Restart your session for the changes to take effect. ===== Making Powershell look pretty ===== ==== Message box pop-ups ==== * https://itfordummies.net/2014/10/15/create-messagebox-easely-powershell/ ==== Input Box pop-up ==== * https://itfordummies.net/2016/05/09/create-input-box-powershell/ ==== Open up a file browser to pick a path ==== * https://gallery.technet.microsoft.com/scriptcenter/GUI-popup-FileOpenDialog-babd911d * https://devblogs.microsoft.com/scripting/hey-scripting-guy-can-i-open-a-file-dialog-box-with-windows-powershell/ * (I like this one the best, very redundant for normal users) https://code.adonline.id.au/folder-file-browser-dialogues-powershell/ ==== Open up a file browser with specified file types ==== ==== File Browser, save path ==== * http://ilovepowershell.com/2017/03/08/how-to-open-a-directory-chooser-window-with-powershell/ ==== Custom GUI ==== * https://syscloudpro.com/2014/03/11/powershell-custom-gui-input-box-for-passing-values-to-variables/