PowerShell Tips

In this post, I will just list some of the commands I used them during some of my work, many of them are very easy but the idea is to list them so I can remember what I have used 🙂

Prompt for input 



Tip If you would like to learn more about how to work with SSRS PowerShell so we can remap SSRS or SQL Sever Reporting Server Database to an existing DB, we will see also how to restore SSRS encryption key – have a look at this post- have a look at the this post


Send argument and use it with Invoke-Command

The argument sent at the end of the script block as an array, so if I want to access it within the script block, I just use it as $ args[0], or $args[1], etc.



More InfoIf you would like to know more about Azure deployments, have a look at the post How to deploy to Azure using Team Services Release Management. The post describes how Azure deployments are made easy by using Visual Studio Team Services (VSTS) Release Management. You will see a step-by-step tutorial on how to configure and deploy to Azure in Release Management, and, moreover, how to configure an end-to-end pipeline for deploying applications on Azure.


Execution Policy 


The Default Execution Policy is set to restricted, we can see it by typing:

We can change it and type the following to make it go to unrestricted mode:

Import Module to use its command in the current session

AzureRM Modules has sub Modules like:

  • AzureRM.Profile
  • Azure.Storage
  • AzureRM.Automation
  • AzureRM.Backup
  • AzureRM.Billing
  • AzureRM.ContainerRegistry
  • AzureRM.DevTestLabs
  • AzureRM.KeyVault
  • And many others.

Get what are the current Modules loaded in the current session

Get-Module PowerShell

Get-Module PowerShell


Get-Command to list all the command inside a loaded Module

Get-command -Module Module Name

Get-command -Module Module Name

Get-help to get help about desired command

PowerShell get-help command

PowerShell get-help command

Get-help examples to get examples of desired command

PowerShell get help examples

PowerShell get help examples


Share This: