public void Execute(IActivityRequest request, IActivityResponse response) { string messageQueue = request.Inputs[destinationQueue].AsString(); string message = request.Inputs[inputMessage].AsString(); bool useAuthentication = request.Inputs[authentiation].AsBoolean(); // check if queue exists, if not create it MessageQueue msMq = null; if (!MessageQueue.Exists(messageQueue)) { throw new Exception(String.Format("The message queue\n{0}\ndoes not exist", messageQueue)); } else { msMq = new MessageQueue(messageQueue); } using (msMq) { Message msg = new Message(message); msg.UseAuthentication = useAuthentication; msMq.Send(msg, MessageQueueTransactionType.Single); } response.Publish(destinationQueue, messageQueue); response.Publish(inputMessage, message); response.Publish(authentiation, useAuthentication); response.Publish(status, "Success"); }
public void Execute(IActivityRequest request, IActivityResponse response) { string comment = string.Empty; string DfsEntryPath = request.Inputs[ResourceStrings.DfsEntryPath].AsString(); string ServerName = request.Inputs[ResourceStrings.ServerName].AsString(); string PathName = request.Inputs[ResourceStrings.DfsEntryPath].AsString(); bool DFS_ADD_VOLUME = Convert.ToBoolean(request.Inputs[ResourceStrings.DFS_ADD_VOLUME].AsString()); if (request.Inputs.Contains(ResourceStrings.Comment)) { comment = request.Inputs[ResourceStrings.Comment].AsString(); } int result = 0; if (DFS_ADD_VOLUME) { result = NetDfsAdd(DfsEntryPath, ServerName, PathName, comment, ResourceStrings.Value_DFS_ADD_VOLUME); } else { result = NetDfsAdd(DfsEntryPath, ServerName, PathName, comment, ResourceStrings.Value_NO_DFS_ADD_VOLUME); } response.Publish(ResourceStrings.NERR_Success, result); response.Publish(ResourceStrings.DfsEntryPath, DfsEntryPath); }
public void Execute(IActivityRequest request, IActivityResponse response) { String sourceForestName = request.Inputs["Source Forest Name"].AsString(); String targetForestName = request.Inputs["Target Forest Name"].AsString(); String TargetForestUsername = String.Empty; String TargetForestUserPassword = String.Empty; TargetForestUsername = request.Inputs["Target Forest Username"].AsString(); TargetForestUserPassword = request.Inputs["Target Forest User Password"].AsString(); Forest sourceForest; Forest targetForest; sourceForest = Forest.GetForest(new DirectoryContext(DirectoryContextType.Forest, sourceForestName, credentials.UserName + "@" + credentials.Domain, credentials.Password)); if (TargetForestUsername != String.Empty && TargetForestUserPassword != String.Empty) { targetForest = Forest.GetForest(new DirectoryContext(DirectoryContextType.Forest, targetForestName, TargetForestUsername, TargetForestUserPassword)); } else { targetForest = Forest.GetForest(new DirectoryContext(DirectoryContextType.Forest, targetForestName, credentials.UserName + "@" + credentials.Domain, credentials.Password)); } sourceForest.DeleteTrustRelationship(targetForest); response.Publish("Source Forest Name", sourceForestName); response.Publish("Target Forest Name", targetForestName); }
public void Execute(IActivityRequest request, IActivityResponse response) { string destinationFile = request.Inputs["Destination Location"].AsString(); string originZip = request.Inputs["Origin Zip"].AsString(); string destinationExistsChoice = request.Inputs["If the Destination Files Exist"].AsString(); int numberOfFiles = 0; bool warn = false; String warnMessage = String.Empty; DirectoryInfo DestinationFolder = new DirectoryInfo(destinationFile); FileInfo zipFile = new FileInfo(originZip); if (zipFile.Exists) { if (!DestinationFolder.Exists) { DestinationFolder.Create(); } using (ZipFile zip1 = ZipFile.Read(zipFile.FullName.ToString())) { foreach (ZipEntry e in zip1) { numberOfFiles = numberOfFiles + 1; try { switch (destinationExistsChoice) { case "Overwrite": e.Extract(DestinationFolder.ToString(), ExtractExistingFileAction.OverwriteSilently); break; case "Do not overwrite": e.Extract(DestinationFolder.ToString(), ExtractExistingFileAction.DoNotOverwrite); break; default: e.Extract(DestinationFolder.ToString(), ExtractExistingFileAction.OverwriteSilently); break; } } catch (Exception error) { warn = true; warnMessage += error.Message + "\n"; } } } } else { response.LogErrorMessage("Cannot find Zip file " + request.Inputs["Origin Zip"].AsString()); } response.Publish("Destination Location", DestinationFolder.FullName.ToString()); response.Publish("Number of files decompressed", numberOfFiles.ToString()); if (warn) { response.LogWarningMessage(warnMessage); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; //default timeout == 60 seconds int timeout = 60000; String netBiosName = null; if (request.Inputs.Contains("Ping Timeout (Seconds)")) { try { timeout = Convert.ToInt32(request.Inputs["Ping Timeout (Seconds)"].AsString()) * 1000; } catch { timeout = 60000; } } netBiosName = request.Inputs["Netbios Name"].AsString(); _1EWakeUp(netBiosName); PingReply reply; bool exit = false; do { reply = pingServer(response, 5000, netBiosName); timeout -= 5000; if (timeout <= 0) { exit = true; } else { if (reply != null) { if (reply.Status == IPStatus.Success) { exit = true; } } } }while (!exit); if (reply == null) { throw new Exception(String.Format("Machine {0} Failed to Ping", netBiosName)); } else { if (reply.Status != IPStatus.Success) { throw new Exception(String.Format("Machine {0} Failed to Ping", netBiosName)); } else { response.Publish("Ping Result", reply.Status); } } response.Publish("Netbios Name", netBiosName); }
public void Execute(IActivityRequest request, IActivityResponse response) { userName = settings.UserName; password = settings.Password; domain = settings.Domain; serviceURL = settings.ServiceUrl; exchangeVersion = settings.ExchangeVersion; emailID = request.Inputs["Email ID"].AsString(); ExchangeService service = new ExchangeService(); switch (exchangeVersion) { case "Exchange2007_SP1": service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); break; case "Exchange2010": service = new ExchangeService(ExchangeVersion.Exchange2010); break; case "Exchange2010_SP1": service = new ExchangeService(ExchangeVersion.Exchange2010_SP1); break; default: service = new ExchangeService(); break; } service.Credentials = new WebCredentials(userName, password, domain); String AccountUrl = userName + "@" + domain; if (serviceURL.Equals("Autodiscover")) { service.AutodiscoverUrl(AccountUrl); } else { service.Url = new Uri(serviceURL); } PropertySet propSet = new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.MimeContent, EmailMessageSchema.IsRead); EmailMessage message = EmailMessage.Bind(service, emailID, propSet); getAttachments(message); if (message.HasAttachments) { response.Publish("Email Exported", message.Id.ToString()); response.WithFiltering().PublishRange(getAttachments(message)); } else { response.Publish("Email Exported", message.Id.ToString()); response.WithFiltering().PublishRange(getAttachments(message)); } }
public void Execute(IActivityRequest request, IActivityResponse response) { using (var ping = new Ping()) { PingReply reply = ping.Send(request.Inputs[NAME].AsString()); response.Publish(STATUS, reply.Status); response.Publish(ROUND_TRIP_TIME, reply.RoundtripTime); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String varType = request.Inputs["Variable Name"].AsString(); MachineName = request.Inputs["Machine Name"].AsString(); String resourceID = String.Empty; if (request.Inputs.Contains("Resource ID")) { resourceID = request.Inputs["Resource ID"].AsString(); } //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { //Get Computer Object IResultObject computerObj = null; IResultObject col = null; if (resourceID.Equals(String.Empty)) { col = CMInterop.getSCCMComputer(connection, "", MachineName, ""); } else { col = CMInterop.getSCCMComputer(connection, resourceID, "", ""); } foreach (IResultObject c in col) { computerObj = c; if (computerObj != null) { //Get Variables from Comoputer Object List <IResultObject> variableCollection = CMInterop.getSCCMComputerVariables(connection, computerObj["ResourceID"].IntegerValue.ToString()); if (variableCollection != null) { response.WithFiltering().PublishRange(getComputerVariables(variableCollection)); response.Publish("Number of Machine Variables", variableCollection.Count); } response.Publish("Number of Machine Variables", 0); } else { response.LogErrorMessage("Could Not Find Computer " + MachineName); } } } }
public void Execute(IActivityRequest request, IActivityResponse response) { String commandText = request.Inputs[ResourceStrings.sqlQuery].AsString(); String connectionString = request.Inputs[ResourceStrings.ConnectionString].AsString(); Dictionary <string, string> ParameterList = new Dictionary <string, string>(); int timeout = -1; if (request.Inputs.Contains(ResourceStrings.Timeout)) { timeout = request.Inputs[ResourceStrings.Timeout].AsInt32(); } for (int i = 0; i < _maxParameterNumber; i++) { if (request.Inputs.Contains(i.ToString() + " Parameter Name") && request.Inputs.Contains(i.ToString() + " Parameter Value")) { string paramName = request.Inputs[i.ToString() + " Parameter Name"].AsString(); string paramValue = request.Inputs[i.ToString() + " Parameter Value"].AsString(); ParameterList.Add(paramName, paramValue); } } SqlConnection connection = new SqlConnection(connectionString); try { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandText = commandText; if (timeout > 0) { command.CommandTimeout = timeout; } foreach (String paramName in ParameterList.Keys) { command.Parameters.AddWithValue(paramName, ParameterList[paramName]); } connection.Open(); SqlDataReader reader = command.ExecuteReader(); response.WithFiltering().PublishRange(parseResults(reader)); } catch { throw; } finally { connection.Close(); } response.Publish(ResourceStrings.ConnectionString, connectionString); response.Publish(ResourceStrings.Query, commandText); response.Publish(ResourceStrings.NumberOfRows, numberOfResults); }
public void Execute(IActivityRequest request, IActivityResponse response) { String HostName = request.Inputs["Host Name"].AsString(); String Command = request.Inputs["Command"].AsString(); String keyFileLocation = String.Empty; String keyFilePassphrase = String.Empty; Dictionary <string, string> returnValues = new Dictionary <string, string>(); if (request.Inputs.Contains("Key File Location")) { keyFileLocation = request.Inputs["Key File Location"].AsString(); } if (request.Inputs.Contains("Key File Passphrase")) { keyFilePassphrase = request.Inputs["Key File Passphrase"].AsString(); } if (keyFileLocation.Equals(String.Empty)) { using (SshClient client = new SshClient(Credentials.serverName, Credentials.UserName, Credentials.Password)) { client.Connect(); returnValues = runCommand(client, HostName, Command); client.Disconnect(); } } else { if (keyFilePassphrase.Equals(String.Empty)) { using (var client = new SshClient(Credentials.serverName, Credentials.UserName, new PrivateKeyFile(keyFileLocation))) { client.Connect(); returnValues = runCommand(client, HostName, Command); client.Disconnect(); } } else { using (var client = new SshClient(Credentials.serverName, Credentials.UserName, new PrivateKeyFile(keyFileLocation, keyFilePassphrase))) { client.Connect(); returnValues = runCommand(client, HostName, Command); client.Disconnect(); } } } response.Publish("Command Output", returnValues["Command Output"]); response.Publish("Command Extended Output", returnValues["Command Extended Output"]); }
public void Execute(IActivityRequest request, IActivityResponse response) { IRunspaceManager runspaceManager = PSRunspaceManger.CreateClient(); RemoteOperationResult result = runspaceManager.ExecuteCommand(request.Inputs["Session name"].AsString().ToUpper(), request.Inputs["Script code"].AsString()); if (!result.Success) { throw new Exception(result.Message); } response.Publish("Session name", request.Inputs["Session name"].AsString().ToUpper()); response.Publish("Script result", result.Message); }
public void Execute(IActivityRequest request, IActivityResponse response) { string command = string.Format("Set-Variable {0} \"{1}\" ", request.Inputs["Variable name"].AsString(), request.Inputs["Variable value"].AsString()); IRunspaceManager runspaceManager = PSRunspaceManger.CreateClient(); RemoteOperationResult result = runspaceManager.ExecuteCommand(request.Inputs["Session name"].AsString().ToUpper(), command); if (!result.Success) { throw new Exception(result.Message); } response.Publish("Session name", request.Inputs["Session Name"].AsString().ToUpper()); response.Publish("Variable value", result.Message); }
public void Execute(IActivityRequest request, IActivityResponse response) { String JobId = request.Inputs["Job Id"].AsString(); OrchestratorContext sco = new OrchestratorContext(new Uri(Credentials.OrchestratorServiceURL)); sco.Credentials = new NetworkCredential(Credentials.UserName, Credentials.Password, Credentials.Domain); sco.MergeOption = MergeOption.OverwriteChanges; JobInstance jobInstance = SCOrch.getJobDetails(sco, new Guid(JobId)); response.WithFiltering().PublishRange(parseResults(jobInstance)); response.Publish("Number of Input Parameters", inputParamNumber); response.Publish("Number of Output Parameters", outputParamNumber); }
public void Execute(IActivityRequest request, IActivityResponse response) { string userDn = CapitalizeLDAPPath(request.Inputs["User LDAP Path"].AsString()); string password = request.Inputs["New User Password"].AsString(); string changePassword = "******"; if (request.Inputs.Contains("User Must Change Password")) { changePassword = request.Inputs["User Must Change Password"].AsString(); } if (DirectoryEntry.Exists(userDn)) { try { DirectoryEntry uEntry = new DirectoryEntry(userDn); uEntry.Invoke("SetPassword", new object[] { password }); uEntry.Properties["LockOutTime"].Value = 0; //unlock account switch (changePassword) { case "Yes": uEntry.Properties["pwdLastSet"].Value = -1; //set password to must change break; case "No": uEntry.Properties["pwdLastSet"].Value = 0; //set password to must change break; default: uEntry.Properties["pwdLastSet"].Value = -1; //set password to must change break; } uEntry.CommitChanges(); uEntry.Close(); response.Publish("User LDAP Path", userDn); response.Publish("User Must Change Password", changePassword); } catch (System.DirectoryServices.DirectoryServicesCOMException E) { throw E; } } else { throw new Exception("User with DN " + userDn + " does not exist"); } }
public void Execute(IActivityRequest request, IActivityResponse response) { String sourceForestName = request.Inputs["Source Forest Name"].AsString(); String targetForestName = request.Inputs["Target Forest Name"].AsString(); String trustRelationshipDirection = request.Inputs["Trust Relationship Direction"].AsString(); String TargetForestUsername = String.Empty; String TargetForestUserPassword = String.Empty; TargetForestUsername = request.Inputs["Target Forest Username"].AsString(); TargetForestUserPassword = request.Inputs["Target Forest User Password"].AsString(); Forest sourceForest; Forest targetForest; sourceForest = Forest.GetForest(new DirectoryContext(DirectoryContextType.Forest, sourceForestName, credentials.UserName + "@" + credentials.Domain, credentials.Password)); if (TargetForestUsername != String.Empty && TargetForestUserPassword != String.Empty) { targetForest = Forest.GetForest(new DirectoryContext(DirectoryContextType.Forest, targetForestName, TargetForestUsername, TargetForestUserPassword)); } else { targetForest = Forest.GetForest(new DirectoryContext(DirectoryContextType.Forest, targetForestName, credentials.UserName + "@" + credentials.Domain, credentials.Password)); } switch (trustRelationshipDirection) { case "Outbound": sourceForest.CreateTrustRelationship(targetForest, TrustDirection.Outbound); break; case "Inbound": sourceForest.CreateTrustRelationship(targetForest, TrustDirection.Inbound); break; case "Bidirectional": sourceForest.CreateTrustRelationship(targetForest, TrustDirection.Bidirectional); break; default: sourceForest.CreateTrustRelationship(targetForest, TrustDirection.Outbound); break; } response.Publish("Source Forest Name", sourceForestName); response.Publish("Target Forest Name", targetForestName); }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["CI_ID"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { String[] propertyNameChoices = CMInterop.getSCCMObjectPropertyNames(connection, "SMS_AuthorizationList"); foreach (String propertyName in propertyNameChoices) { if ((request.Inputs.Contains(propertyName + " : Property Type")) && (request.Inputs.Contains(propertyName + " : Property Value"))) { CMInterop.modifySCCMAuthorizationList(connection, objID, request.Inputs[(propertyName + " : Property Type")].AsString(), propertyName, request.Inputs[(propertyName + " : Property Value")].AsString()); } } IResultObject col = null; col = CMInterop.getSCCMAuthorizationList(connection, "CI_ID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Authorization Lists", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { String sourcePath = request.Inputs["Source File Path"].AsString(); String savePath = request.Inputs["Destination File Path"].AsString(); bool useSSL = Convert.ToBoolean(request.Inputs["UseSSL"].AsString()); // Get the object used to communicate with the server. FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(savePath); ftpWebRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails; ftpWebRequest.EnableSsl = useSSL; // This example assumes the FTP site uses anonymous logon. ftpWebRequest.Credentials = new NetworkCredential(settings.UserName, settings.Password); FtpWebResponse ftpWebResponse = (FtpWebResponse)ftpWebRequest.GetResponse(); Stream responseStream = ftpWebResponse.GetResponseStream(); using (StreamReader sr = new StreamReader(responseStream)) { while (sr.Peek() >= 0) { response.Publish("File Details", sr.ReadLine()); } } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; int referenceID = (int)request.Inputs["Reference Computer Resource ID"].AsUInt32(); int destinationID = (int)request.Inputs["Destination Computer Resource ID"].AsUInt32(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { CMInterop.associateComputer(connection, referenceID, destinationID); IResultObject col = null; col = CMInterop.getSCCMComputer(connection, Convert.ToString(destinationID), "", ""); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Systems", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String pkgID = request.Inputs["Existing Package ID"].AsString(); String prgName = request.Inputs["New Program Name"].AsString(); String prgComment = request.Inputs["New Program Comment"].AsString(); String prgCommandLine = request.Inputs["New Program Command Line"].AsString(); int prgMaxRunTime = (int)request.Inputs["New Program Max Runtime"].AsUInt32(); String prgWorkingDirectory = request.Inputs["New Program Working Directory"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { IResultObject col = CMInterop.createSCCMProgram(connection, pkgID, prgName, prgComment, prgCommandLine, prgMaxRunTime, prgWorkingDirectory); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Programs", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Collection ID"].AsString(); String ruleName = request.Inputs["Rule Name"].AsString(); String wqlQuery = request.Inputs["WQL Query"].AsString(); String limitCollectionID = String.Empty; if (request.Inputs.Contains("Collection ID to Limit Query To")) { limitCollectionID = request.Inputs["Collection ID to Limit Query To"].AsString(); } //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { CMInterop.addSCCMCollectionRule(connection, objID, ruleName, wqlQuery, limitCollectionID); IResultObject col = null; col = CMInterop.getSCCMCollection(connection, "CollectionID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Collections", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { computerName = request.Inputs["Computer Name"].AsString(); taskName = request.Inputs["Task Name"].AsString(); response.WithFiltering().PublishRange(getScheduledTasks()); response.Publish("Number of Tasks", numberOfTasks); }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String filter = request.Inputs["Filter Query"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { IResultObject col = CMInterop.getSCCMObject(connection, "SMS_R_System", filter); List <system> systemCollection = new List <system>(); foreach (IResultObject obj in col) { ObjCount++; systemCollection.Add(new system(obj)); } if (systemCollection != null) { response.WithFiltering().PublishRange(getObjects(systemCollection)); } response.Publish("Number of Systems", ObjCount); CMInterop.removeSCCMObject(connection, filter, "SMS_R_System"); } }
public void Execute(IActivityRequest request, IActivityResponse response) { string ouName = request.Inputs["New OU Name"].AsString(); string parentLDAPPath = CapitalizeLDAPPath(request.Inputs["Parent OU LDAP Path"].AsString()); string ouDescription = string.Empty; if (request.Inputs.Contains("New OU Description")) { ouDescription = request.Inputs["New OU Description"].AsString(); } string connectionPrefix = parentLDAPPath; DirectoryEntry dirEntry = new DirectoryEntry(connectionPrefix, credentials.UserName + "@" + credentials.Domain, credentials.Password); DirectoryEntry newOU = dirEntry.Children.Add("OU=" + ouName, "OrganizationalUnit"); try { if (!ouDescription.Equals(string.Empty)) { newOU.Properties["description"].Value = ouDescription; } newOU.CommitChanges(); } catch (Exception e) { response.ReportErrorEvent("Error setting description", e.Message.ToString()); } string ouLDAPPath = newOU.Path; response.Publish("Organization Unit LDAP Path", ouLDAPPath); }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Collection ID"].AsString(); String ruleName = request.Inputs["Rule Name"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CM2012Interop.connectSCCMServer(SCCMServer, userName, password); using (connection) { CM2012Interop.removeSCCMCollectionMember(connection, objID, ruleName); IResultObject col = null; col = CM2012Interop.getSCCMCollection(connection, "CollectionID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Collections", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { string EndingBefore = request.Inputs["Clear History Before Date"].AsString(); string actionResult = FimSyncWmiServices.ClearPasswordHistory(connectionSettings, EndingBefore); response.Publish("Action Result", actionResult); }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Advertisement ID"].AsString(); DateTime startTime = request.Inputs["Start Time"].AsDateTime(); int dayDuration = request.Inputs["Day Duration"].AsInt32(); int hourDuration = request.Inputs["Hour Duration"].AsInt32(); int minuteDuration = request.Inputs["Minute Duration"].AsInt32(); bool isGMT = request.Inputs["Is GMT"].AsBoolean(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { CMInterop.modifySCCMAdvertisementAddAssignmentScheduleNonReccuring(connection, objID, isGMT, dayDuration, hourDuration, minuteDuration, startTime); IResultObject col = CMInterop.getSCCMAdvertisement(connection, "AdvertisementID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Advertisements", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String DisplayName = request.Inputs["Display Name"].AsString(); String Description = request.Inputs["Description"].AsString(); String InformativeURL = request.Inputs["Informative URL"].AsString(); String LocaleID = request.Inputs["LocaleID"].AsString(); String UpdatesList = request.Inputs["Updates List (CSV)"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CM2012Interop.connectSCCMServer(SCCMServer, userName, password); using (connection) { try { IResultObject col = CM2012Interop.createSCCMAuthorizationList(connection, DisplayName, Description, InformativeURL, LocaleID, UpdatesList); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } } catch (Exception ex) { response.LogErrorMessage(ex.Message); } response.Publish("Number of Packages", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String pkgName = request.Inputs["New Package Name"].AsString(); String pkgDescription = request.Inputs["New Package Description"].AsString(); int pkgSourceFlag = (int)request.Inputs["New Package Source Flag"].AsUInt32(); String pkgSourcePath = request.Inputs["New Package Source Path"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CM2012Interop.connectSCCMServer(SCCMServer, userName, password); using (connection) { IResultObject col = CM2012Interop.createSCCMPackage(connection, pkgName, pkgDescription, pkgSourceFlag, pkgSourcePath); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Packages", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Collection ID"].AsString(); String contentIDList = request.Inputs["Content ID List (CSV)"].AsString(); bool refreshDPs = request.Inputs["Refresh DPs"].AsBoolean(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CM2012Interop.connectSCCMServer(SCCMServer, userName, password); using (connection) { CM2012Interop.modifySCCMSoftwareUpdatesPackageRemoveCIs(connection, objID, contentIDList, refreshDPs); IResultObject col = null; col = CM2012Interop.getSCCMSoftwareUpdatesPackage(connection, "PackageID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Collections", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String filter = request.Inputs["Filter Query"].AsString(); String objClass = request.Inputs["Class"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { IResultObject col = CMInterop.getSCCMObject(connection, objClass, filter); CMInterop.removeSCCMObject(connection, filter, objClass); foreach (IResultObject obj in col) { ObjCount++; } response.Publish("Number of Objects", ObjCount); } }