- Installing Modules
- Terminal Emulator Quake Mode on startup
- Often forgotten
- File Locations of PS Components
- Authentication Methods
- Tools
- Traps and Gotchas
- PowerShell Resources
Installing Modules
Unless you’re working on a server, a PAW, with a lot of different local profiles, or with an automation solution, strongly consider always installing modules to CurrentUser scope. Its easier to maintain, update, etc
Install-Module <<MODULENAME>> -Scope CurrentUser
See Module Management in PowerShell Commands for more commands.
Terminal Emulator Quake Mode on startup
Use a shell/terminal emulator that you can start on startup and that supports what is often called quake mode. cmder and Windows Terminal support quake mode and it shouldn’t be too hard tell windows to launch them on startup.
The idea is that you will use a very quick keyboard shortcut (normally CTRL + ~) to bring up the shell and hide it (but not close it) again and often, so its quickly available for you. By reducing the time to get to the shell and also your brain becoming more aware that its quicker to get to, you will start using it more often, thus getting you more experience.
No matter what your terminal emulator to shell, learn common shortcuts to help with your speed.
Often forgotten
Checkout Commands often forgotten in PowerShell Commands
Checkout Variables often forgotten in PowerShell Commands
File Locations of PS Components
Modules
PowerShell 7:
- Modules installed in the CurrentUser scope:
- On Windows, these modules are stored in $HOME\Documents\PowerShell\Modules. The specific location of the Documents folder varies by version of Windows and when you use folder redirection. Also, Microsoft OneDrive can change the location of your Documents folder. To verify the location of your Documents folder, run use the following command: [Environment]::GetFolderPath(‘MyDocuments’).
- On non-Windows systems, these modules are stored in the $HOME/.local/share/powershell/Modules folder.
- Modules installed in the AllUsers scope:
- On Windows, these modules are stored in $env:ProgramFiles\PowerShell\Modules.
- On non-Windows systems, these modules are stored in /usr/local/share/powershell/Modules.
- Modules that ship with PowerShell are stored in $PSHOME\Modules
Windows PowerShell 5.1:
- Modules installed in the CurrentUser scope are stored in
$HOME\Documents\WindowsPowerShell\Modules
. - Modules installed in the AllUsers scope are stored in
$env:ProgramFiles\WindowsPowerShell\Modules
. - Modules that ship with Windows PowerShell stored in
$PSHOME\Modules
, which is$env:SystemRoot\System32\WindowsPowerShell\1.0\Modules
. -
$HOME\OneDrive - Contoso\Documents\WindowsPowerShell\Modules
: Windows PowerShell 5.1 Modules for current user but you have OneDrive known Office folder move on. There are some hiccups and a little pain with this but its manageable.\
Authentication Methods
-DeviceLogin
: Really good if you access multiple tenants or have multiple accounts.
-Interactive
Using Single Browser with multiple profiles
-
Type up tip about moving tabs when using
-devicelogin
Tools
https://cmder.app/: Nice terminal emulator that has a bunch of great includes. https://aka.ms/terminal / https://github.com/microsoft/terminal - i’m not totally on the Windows Terminal bandwagon yet but its not shit.
Also check Misc Tools
Traps and Gotchas
https://github.com/nightroman/PowerShellTraps
Invoke-WebRequest and Invoke-RestMethod on PS5
Invoke-WebRequest
and Invoke-RestMethod
on Windows PowerShell 5.1 does not have the parameter -Authentication
, Only PowerShell7 does. This means you have to manually construct the header to include authentication.
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-5.1
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.5#-authentication
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-5.1
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.5#-authentication