How to run Orchestrator Runbook using PowerShell?

Over the web many people have written already how to achieve it using PowerShell or WebService. My attempt is just to club all required pieces and simplifies for any newbie who is attempting it first time. Alright, we need Runbook Server Name, Runbook Id, and RunBook Parameters GUIDs to invoke any runbook using PowerShell. HereContinue reading “How to run Orchestrator Runbook using PowerShell?”

How to update app.config file using PowerShell?

Below code will help to update app.config file with given data- #It helps to connect db and get the data. $HostName = $env:computername $connectionstring = ‘Server=XX.XX.XX.XX;Database=TestDataBase;User Id=VM;Password=VMTest;MultipleActiveResultSets=True’ $connection = New-Object System.Data.SqlClient.SqlConnection $connection.ConnectionString = $connectionString $connection.Open() $query = “SELECT [Params].value(‘(/root//Version/node())[1]’, ‘nvarchar(max)’) as FirstName from Request where [Params].value(‘(/root//Name/node())[1]’, ‘nvarchar(max)’) = ‘”+$HostName+”‘” $command = $connection.CreateCommand() $command.CommandText = $queryContinue reading “How to update app.config file using PowerShell?”

How to convert PowerShell Object to a String?

Alike any other languages, PowerShell script also supports conversion of an object to a string for many kinds of manipulations. In my course of actions, I have come across two ways which help to convert Object to a string very easily. Out-String $string = Get-CimInstance Win32_OperatingSystem | Select-Object {$_.Version} | Out-String %{$_.Version} $string = Get-CimInstanceContinue reading “How to convert PowerShell Object to a String?”