Can anyone please breakdown what is going on in this script?

$node = $appConfig.configuration.connectionStrings.add | Where-Object {$ -eq $dbName} $node.connectionString = $updatedConnectionString Where did add come from? What does $_ stand for here? How is $node.connectionString assigning to the attribute when there is no property on $node called connectionString? Lastly, any resource that can help me understand this and not ask stupid questions will be really […]

Wrapper for New-CimSession

Hi, I’m currently writing a bunch of tools that require CimSessions. I noticed that I’m creating a new CimSession in each tool, doing my thing, and removing the CimSession. The controller script runs each of those tools, resulting in slow performance due to the many CimSessions being established and removed again. So I thought it’s […]

I’m afraid of nesting foreach loops, so I wrote this cockamamie script to get installed hotfixes. But I’m pretty sure there’s a better way to do it. Please help.

So I need to check a list of computers to see if they have these specific KB’s installed, and I can foreach the comps OK, but I’m pretty sure I have a lot of unnecessary code in here. Is there a way to put these KBs into an array and nest a foreach loop inside […]

New to C#, having trouble with reflection?

I started by posting this in learnc# and I asked a few people I know. public static class MagicObjectColumns { public static EntityColumn ValName1; public static EntityColumn ValName2; public static EntityColumn ValName3; public static EntityColumn ValName4; public static EntityColumn ValName5; public static List<EntityColumn> AllColumns { get; } } I have an Expando Object that can […]