Getting help for a command, e.g. Get-ChildItem:
Get-Help Get-ChildItemUsing behind corporate proxy - suggest putting in your profile script (see below):
[System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy('<address>:<port>')
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[System.Net.WebRequest]::DefaultWebProxy.BypassProxyOnLocal = $trueRegistering the PSGallery repository:
Register-PSRepository -Default
Get-PSRepositoryWhich version are we running?
$PSVersionTableCreate new profile script:
New-Item $Profile -Type File -ForceReload profile script:
Invoke-Expression $Profile
# Or use the alias:
iex $ProfileCheck if path exists:
Test-Path <path>List aliases:
Get-AliasList commands:
Get-CommandList modules:
Get-Module
Get-Module -ListAvailableInstall a module, e.g. Azure:
Install-Module -Name Azure -Repository PSGallery -Force
# Run `Get-Module -ListAvailable` after it's installed to see all related modules.
Import-Module AzureRM.profile
Import-Module Azure.Storage
Import-Module Azure
# Now `Get-Module` (on its own) shows the Azure modules you just imported.Pipelines and object filtering:
Get-Module | Where-Object { $_.Name -Match "^Azure.*" } | Remove-ModuleManaging output:
Get-Command | Out-Host # The default, same as running `Get-Command` with no piping
Get-Command | Out-Host -Paging
<some command> | Out-Null # Analogous to sending output to /dev/null
Get-Command | Out-File ".\commands.txt" # Must specify the "."Showing specific properties:
(Get-Command).Name # For single property
Get-Command | Select-Object -Property Name # Does the same
Get-Command | Select-Object -Property Name,Source # For multiple propertiesGetting and setting environment variables:
$env:FOO # getting
$env:FOO = "bar" # setting