1. Get powershell history:
notepad (Get-PSReadlineOption).HistorySavePath
2. Work with APPX packages:
# Get list of packages
Get-AppxPackage | Select Name, PackageFullNamer
# Add package from file
Add-AppxPackage -Path "path_to_the_file.msix"
# Remove package
Get-AppxPackage *PACKAGE_NAME* | Remove-AppxPackage
3. Get available parameters for the powershell command:
(Get-Command COMMAND_NAME).Parameters
4. Work with Powershell modules:
# Get modules list
Get-Module -ListAvailable
# Save module to another place (PATH_TO_NEW_MODULES_FOLDER)
Save-Module -Name Module_name -Path PATH_TO_NEW_MODULES_FOLDER -Repository PSGallery
5. Work with Powershell profile:
# Create profile if it not exist
if ((Test-Path $profile) -eq $false) {
New-Item -path $profile -type file –force
}
# Edit profile
notepad $profile
6. Add custom path for modules in Powershell $profile:
$env:PSModulePath = ((@("PATH_TO_NEW_MODULES_FOLDER") + ($env:PSModulePath -split ";")) -join ";")
That’s all.