protected void addComputerToCollection(string resourceID, string collectionID) { /* Set collection = SWbemServices.Get ("SMS_Collection.CollectionID=""" & CollID &"""") * * Set CollectionRule = SWbemServices.Get("SMS_CollectionRuleDirect").SpawnInstance_() * CollectionRule.ResourceClassName = "SMS_R_System" * CollectionRule.RuleName = "Static-"&ResourceID * CollectionRule.ResourceID = ResourceID * collection.AddMembershipRule CollectionRule*/ //o.Properties["ResourceID"].Value.ToString(); var pathString = "\\\\srv-cm12-p01.srv.aau.dk\\ROOT\\SMS\\site_AA1" + ":SMS_Collection.CollectionID=\"" + collectionID + "\""; ManagementPath path = new ManagementPath(pathString); ManagementObject obj = new ManagementObject(path); obj.Scope = new ManagementScope(pathString, SCCM.GetConnectionOptions()); ManagementClass ruleClass = new ManagementClass("\\\\srv-cm12-p01.srv.aau.dk\\ROOT\\SMS\\site_AA1" + ":SMS_CollectionRuleDirect"); ManagementObject rule = ruleClass.CreateInstance(); rule["RuleName"] = "Static-" + resourceID; rule["ResourceClassName"] = "SMS_R_System"; rule["ResourceID"] = resourceID; obj.InvokeMethod("AddMembershipRule", new object[] { rule }); }
public List <string> setConfig(ManagementObjectCollection Collection) { if (SCCM.HasValues(Collection)) { List <string> namesInCollection = new List <string>(); foreach (ManagementObject o in Collection) { //o.Properties["ResourceID"].Value.ToString(); var collectionID = o.Properties["CollectionID"].Value.ToString(); if (collectionID.Equals("AA100015")) { ComputerModel.ConfigPC = "AAU7 PC"; } else if (collectionID.Equals("AA100087")) { ComputerModel.ConfigPC = "AAU8 PC"; } else if (collectionID.Equals("AA1000BC")) { ComputerModel.ConfigPC = "AAU10 PC"; ComputerModel.ConfigExtra = "True"; // Hardcode AAU10 is bitlocker enabled } else if (collectionID.Equals("AA100027")) { ComputerModel.ConfigPC = "Administrativ7 PC"; } else if (collectionID.Equals("AA1001BD")) { ComputerModel.ConfigPC = "Administrativ10 PC"; ComputerModel.ConfigExtra = "True"; // Hardcode AAU10 is bitlocker enabled } else if (collectionID.Equals("AA10009C")) { ComputerModel.ConfigPC = "Imported"; } if (collectionID.Equals("AA1000B8")) { ComputerModel.ConfigExtra = "True"; } var pathString = "\\\\srv-cm12-p01.srv.aau.dk\\ROOT\\SMS\\site_AA1" + ":SMS_Collection.CollectionID=\"" + collectionID + "\""; ManagementPath path = new ManagementPath(pathString); ManagementObject obj = new ManagementObject(); obj.Scope = SCCM.ms; obj.Path = path; obj.Get(); namesInCollection.Add(obj["Name"].ToString()); } return(namesInCollection); } return(null); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } SCCM.Init(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "group", template: "{controller=Group}/{action=Index}/{id?}"); routes.MapRoute( name: "computer", template: "{controller=Computer}/{action=Index}/{id?}"); routes.MapRoute( name: "user", template: "{controller=User}/{action=Index}/{id?}"); routes.MapRoute( name: "defendpointchallengeresponse", template: "{controller=DefendpointChallengeResponse}/{action=Index}/{id?}"); routes.MapRoute( name: "createworkitem", template: "{controller=CreateWorkItem}/{action=Index}/{id?}"); }); }
public void GivenSCCMIsAvailableAtStartUp() { Assert.True(SCCM.isAgentAvailable()); }