Orchestrator SQL Query to query a specific String in .Net Acticity

System Center Orchestrator is an excellent Workflow Engine to run and trigger PowerShell Code. Additionally, SCO provides a way to store Credentials, Server Names, and other recording Values in global Variables. So if a Server Name Changes or Azure App Thumbprint needs to be renewed, you only have to change one Value.

That said, it requires you to work with those Variables and not to store that Hardcoded in the PowerShell .Net Activity.

If you have done so, there is a SQL Query to query all PowerShell .Net Activities for a specific String.

The Query

In my case, I am looking for a specific Servername I want to replace with a global Activity.

		select  pol.Name as Runbook, obj.Name as activity, ScriptBody from RUNDOTNETSCRIPT as NET 
		join [Orchestrator].[dbo].[OBJECTS] as obj on NET.UniqueID = Obj.UniqueID
		join [orchestrator].[dbo].[POLICIES] as pol on pol.UniqueID = obj.ParentID
		
where ScriptBody like '%wi-inf-srv-05%'

The Result

So, we can now go to each Runbook and replace the Servername with the SCO Variable

Michael Seidl aka Techguy
au2mate everything

Leave a Comment

Your email address will not be published.

*

%d bloggers like this: