Category Archives: PowerShell

2 ways to retrieve content of Azure Automation Runbook within another runbook

In this post, we’ll see how we can retrieve content of azure automation runbook from within another runbook. This content is loaded in memory. There could be multiple reasons why we would want to┬áretrieve content of azure automation runbook. One … Continue reading

Posted in PowerShell | Tagged , , , , , , | Leave a comment

[PowerShell Tip] – Assign array elements to separate variables in single line of code

Hi, In this post, we’ll see how we can assign array elements to separate variables in a single line of code Consider a sample array $TestArray = @(“FirstElement”, “SecondElement”) Now, to get the value of the elements into separate variables, … Continue reading

Posted in PowerShell | Tagged , , , , | Leave a comment

[PowerShell Tip] – Prevent cmdlet from printing anything to output

Hi, In this short post, we’ll see how we can prevent a PowerShell cmdlet from printing anything to the std output stream. There are two ways you can do this. Piping the output of the cmdlet to Out-Null e.g. Set-AzureRmContext … Continue reading

Posted in PowerShell | Tagged , , , , | Leave a comment

Analyzing PowerShell scripts with PSScriptAnalyzer

Hi, This post will show you how you can use PSScriptAnalyzer to analyze whether your PowerShell scripts or functions confirm with industry best practices or not. PSScriptAnalyzer (PSSA going forward) is a static code analyzer that checks your PowerShell scripts, … Continue reading

Posted in PowerShell | Tagged , , , , , , | Leave a comment

[Powershell-Basics] – Looping through hash table

Hi, This post will show how to loop through a hash table in PowerShell. Let’s say for example we have a hashTable object in PowerShell as shown below: $SampleTable = @{} # Syntax for creating hashtable –> @{} $SampleTable.”Name” = … Continue reading

Posted in PowerShell | Tagged , , , | Leave a comment

Get output of script executed as part of Set-AzureRmVMCustomScriptExecution cmdlet

Hi, This post explains how to retrieve the output of the script that is executed as part of Set-AzureRmVMCustomScriptExecution cmdlet. The cmdlet adds a custom script virtual machine extension to a virtual machine. It lets users run custom scripts on … Continue reading

Posted in .NET, PowerShell | Tagged , , , , , , , , | Leave a comment

Get-AutomationVariable Vs Get-AzureRmAutomationVariable

Hi, I finally started working on PowerShell and so thought that documenting my learnings here would be useful. So in this post, we will see the difference between the 2 cmdlets Get-AzureRmAutomationVariable and Get-AutomationVariable. So let’s see the outputs of … Continue reading

Posted in PowerShell | Tagged , , , , | Leave a comment