How to get access to all Client Desktops from the Active Directory Domain Controller?
To enable Remote Desktop via group policy, you need to:
- Enable Remote Desktop,
- Create the inbound firewall rule,
- (Optionally) Configure the groups allowed to connect.
You can do this by using the following settings:
Computer Configuration > Admin Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Allow users to connect remotely using Remote Desktop Services = Enabled
Computer Configuration > Windows Settings > Security Settings > Windows Firewall with Advanced Security > Windows Firewall with Advanced Security > Inbound Rules 2a. Right-click -> New Rule... 2b. Predefined -> Remote Desktop, Next, Next 2c. Allow the connection, Finish.
Computer Configuration > Windows Settings > Security Settings > Restricted Groups 3a. Right-click -> Add Group, 3b. Use the Browse button to find the domain group that has all the users you want to be able to use RDP in it, click OK, 3c. Click the second Add button (for "This group is a member of:", 3d. Type, Remote Desktop Users, then click OK twice to confirm the policy setting.
These are the minimum settings you will need to specify.
Related videos on Youtube
Alojz Janez
Updated on September 18, 2022Comments
-
Alojz Janez over 1 year
So I am currently parsing emails that we receive from work, all of which are formatted almost exactly the same, and I am getting the data that I need out of all of them, however I am experiencing problems retrieving a "description", which comes in multiple lines. I've tried removing the "\n" out of these strings, but it doesn't always work. When I open the .csv files, the formatting is fine sometimes, but otherwise these extra returns in the strings ruin the entire thing.
Here is my code:
public static void Main(string[] args) { helper(); Console.WriteLine("Press any key to exit ... "); Console.ReadKey(); } //end main method public static void helper() { //initiate outlook Microsoft.Office.Interop.Outlook.Application app = null; Microsoft.Office.Interop.Outlook._NameSpace ns = null; Microsoft.Office.Interop.Outlook.MailItem item = null; Microsoft.Office.Interop.Outlook.MAPIFolder inboxFolder = null; Microsoft.Office.Interop.Outlook.MAPIFolder subFolder = null; try { app = new Microsoft.Office.Interop.Outlook.Application(); ns = app.GetNamespace("MAPI"); ns.Logon(null, null, false, false); inboxFolder = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox); subFolder = inboxFolder.Folders["WorkOrders"]; //folder.Folders[1]; Console.WriteLine("Folder Name: {0}", subFolder.Name); Console.WriteLine("Number of Emails: {0}", subFolder.Items.Count.ToString()); Console.WriteLine(); Console.WriteLine("-------------------------"); Console.WriteLine(); //Variables for loop String sub; String date; String time; String body; String desc; String storeNumber; String workOrderNumber; int indexOfDesc; int indexOfSp; int items = subFolder.Items.Count; DataTable dt = new DataTable(); dt.Columns.Add("Work Order Number"); dt.Columns.Add("Date"); dt.Columns.Add("Store Number"); dt.Columns.Add("Description"); dt.Rows.Add("Work Order Number", "Date", "Store Number", "Description"); dt.Rows.Add("", "", "", ""); // just a blank row for (int i = 1; i <= items; i++) { item = (Microsoft.Office.Interop.Outlook.MailItem)subFolder.Items[i]; sub = item.Subject; date = item.SentOn.ToLongDateString(); body = item.Body; desc = ""; storeNumber = sub.Substring(0, 5); workOrderNumber = sub.Substring(sub.Length - 10); indexOfDesc = body.IndexOf("Description Overview:"); indexOfSp = body.IndexOf("Safety Precautions:"); desc = body.Substring(indexOfDesc, indexOfSp - indexOfDesc); desc = desc.Replace("\t", string.Empty); desc = desc.Replace("\n", string.Empty); // Add row in data table dt.Rows.Add(workOrderNumber, date, storeNumber, desc); // Process Date createCSV(dt); // *** Console Output for testing *** // Console.WriteLine("Index: {0}", i.ToString()); Console.WriteLine("Store Number: {0}", sub.Substring(0, 5)); Console.WriteLine("Work Order Number: # " + workOrderNumber); Console.WriteLine("Sent: {0}", date); Console.WriteLine(desc); Console.WriteLine(); Console.WriteLine("-------------------------"); Console.WriteLine(); } PrintTable(dt); } catch (System.Runtime.InteropServices.COMException ex) { Console.WriteLine(ex.ToString()); } finally { ns = null; app = null; inboxFolder = null; } //end finally } private static void PrintTable(DataTable dt) { DataTableReader dtReader = dt.CreateDataReader(); while (dtReader.Read()) { for (int i = 0; i < dtReader.FieldCount; i++) { Console.Write("{0} = {1} ", dtReader.GetName(i).Trim(), dtReader.GetValue(i).ToString().Trim()); } Console.WriteLine(); } dtReader.Close(); } /** * createCSV(DataTable dt) takes each line from data * table and appends it to a csv file created at the var path * @param dt - DataTable **/ public static void createCSV(DataTable dt) { String path = "C:\\Users\\WORK\\Desktop\\test.csv"; StringBuilder sb = new StringBuilder(); foreach(DataRow dr in dt.Rows){ foreach(DataColumn dc in dt.Columns){ sb.Append(FormatCSV(dr[dc.ColumnName].ToString()) + ","); } // end foreach sb.Remove(sb.Length-1,1); //remove comma sb.AppendLine(); } // end foreach File.WriteAllText(path, sb.ToString()); } // end createCSV() public static string FormatCSV(string input) { try { if (input == null) return string.Empty; bool containsQuote = false; bool containsComma = false; int len = input.Length; for (int i = 0; i < len && (containsComma == false || containsQuote == false); i++) { char ch = input[i]; if (ch == '"') containsQuote = true; else if (ch == ',') containsComma = true; } if (containsQuote && containsComma) input = input.Replace("\"", "\"\""); if (containsComma) return "\"" + input + "\""; else return input; } catch { throw; } } } //end class
And here is a screenshot of what the CSV file looks like. Mind you, all of the descriptions in the email have extra spaces and stuff in them, and I highlighted the rows that worked the way I want them too: no extra spaces, just one line of the proper information. You can see how the returns ruin the spreadsheet though.
So any help would be so greatly appreciated.
-
Alojz Janez almost 11 yearsI searched a lot and could not find the solution on SF or using Google. Please kindly forgive me if I missed a result.
-
TyCobb almost 6 yearsI found it was always best to do replace with
\r\n
,\r
, and\n
in that order. In your case though, you are just replacing with an empty string -- perhaps just also do the\r
replace. -
Admin almost 6 yearsWorked perfectly! add your comment to the answer so I can update it. I replaced "\r\n" with empty, then replaced \r and finally \n and it worked. Thank you so much @TyCobb
-