Why does this Dictionary intialiser throw an exception?

The following code throws this exception with message: An item with the same key has already been added. but yet, no two keys are the same: using System; using System.Collections.Generic; public class Program { public static void Main() { Console.WriteLine(“Minimal example ” + testclass.modeLookUp[“i”]); } public static class testclass { public static Dictionary<string, int> modeLookUp […]

Speed improvement on iterating over an object array?

I’m wondering if anyone can catch anything I’m missing here, or otherwise make a suggestion on how to improve the speed of the following code block: [CmdletBinding()] PARAM() BEGIN{ [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SqlServer.SMO”) | Out-Null $Query = ” SELECT vm.Name as Vm, tag.name as Tag, cat.name as Category, vc.Name AS vCenter FROM [Table] WIth all sorts of Joins […]

General help with scripting

Hi All, I’m looking at automating our WSUS so after 2 weeks it install the update for a live group i created. Thinking of using [reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”) $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer() and then referencing it and doing something with $wsus.GetUpdateApproval( My question is how can you find out what are acceptable parameters for the like of $wsus.GetUpdateApproval( […]